File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -150,6 +150,27 @@ manager that you can use in a ``with``-statement::
150
150
You can use all the standard :py:mod: `contextlib ` APIs to manage this context
151
151
manager.
152
152
153
+ .. attention ::
154
+
155
+ There is an odd interaction with Python 3.4, 3.5, and 3.6 regarding adding
156
+ zip or wheel file paths to ``sys.path ``. Due to limitations in `zipimport
157
+ <https://docs.python.org/3/library/zipimport.html> `_, which can't be
158
+ changed without breaking backward compatibility, you **must ** use an
159
+ absolute path to the zip/wheel file. If you use a relative path, you will
160
+ not be able to find resources inside these zip files. E.g.:
161
+
162
+ **No **::
163
+
164
+ sys.path.append('relative/path/to/foo.whl')
165
+ resource_bytes('foo/data.dat') # This will fail!
166
+
167
+ **Yes **::
168
+
169
+ sys.path.append(os.path.abspath('relative/path/to/foo.whl'))
170
+ resource_bytes('foo/data.dat')
171
+
172
+ Both relative and absolute paths work for Python 3.7 and newer.
173
+
153
174
154
175
.. rubric :: Footnotes
155
176
You can’t perform that action at this time.
0 commit comments