[issue47025] bytes do not work on sys.path

Thomas Grainger report at bugs.python.org
Tue Mar 15 07:11:17 EDT 2022


Thomas Grainger <tagrain at gmail.com> added the comment:

this is a regression from 3.2:

```
Python 3.2.6 (default, Jan 18 2016, 19:21:14) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tempfile
>>> tempfile.TemporaryDirectory()
<TemporaryDirectory '/tmp/tmpd4jzut'>
>>> v = _
>>> tmp_dir = str(v.__enter__())
>>> tmp_dir
'/tmp/tmpd4jzut'
>>> f = open(tmp_dir + "/module.py", "w")
>>> f.write("def function():\n    return 1\n")
29
>>> f.close()
>>> import sys
>>> sys.path.append(tmp_dir.encode())
>>> import module
>>> module
<module 'module' from '/tmp/tmpd4jzut/module.py'>
>>> 
```

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue47025>
_______________________________________


More information about the Python-bugs-list mailing list