Message248241
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. |
|
Date |
User |
Action |
Args |
2015-08-08 01:43:58 | martin.panter | set | recipients:
+ martin.panter, ncoghlan, r.david.murray, eric.snow, Anthony.Kong, berker.peksag, Fotis.Koutoulakis, luiz.poleto, lac |
2015-08-08 01:43:57 | martin.panter | set | messageid: <1438998237.59.0.859141687282.issue19771@psf.upfronthosting.co.za> |
2015-08-08 01:43:57 | martin.panter | link | issue19771 messages |
2015-08-08 01:43:56 | martin.panter | create | |
|