Message248241
| Author |
martin.panter |
| Recipients |
Anthony.Kong, Fotis.Koutoulakis, berker.peksag, eric.snow, lac, luiz.poleto, martin.panter, ncoghlan, r.david.murray |
| Date |
2015年08月08日.01:43:52 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1438998237.59.0.859141687282.issue19771@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Patch v4 just uses an explicit encoding in the test suite rather than relying on the environment’s encoding.
Laura: I think my patch may already handle your case. Assuming this is one way to reproduce it:
$ mkdir test
$ : > test/__init__.py
$ python2 -c 'import test'
$ rm test/__init__.py
$ ./python -m test
/media/disk/home/proj/python/cpython/python: Error while finding spec for 'test.__main__' (<class 'ImportError'>: bad magic number in 'test': b'\x03\xf3\r\n'); 'test' is a package and cannot be directly executed
[Exit 1]
$ hg qpush --move issue_19771_runpy.patch.v4
applying issue_19771_runpy.patch.v4
now at: issue_19771_runpy.patch.v4
$ ./python -m test
/media/disk/home/proj/python/cpython/python: Error while finding spec for 'test.__main__' (ImportError: bad magic number in 'test': b'\x03\xf3\r\n')
[Exit 1]
Perhaps the error could be improved further, though. I guess the problem is there is a bad magic number in test/__init__.pyc. And I have no idea what the "finding spec" bit is about; it is meaningless noise to me. |
|