google / enjarify

Apache License 2.0
2.73k stars 541 forks source link

PyPy3 Issue #7

Closed Konloch closed 9 years ago

Konloch commented 9 years ago

For some reason when using pypy3-2.4.0-win32 and BCV I get this exception: Traceback (most recent call last): File "C:\Users\null.Bytecode-Viewer\enjarify_2\enjarify-master\enjarify\main.py", line 75, in main outfile = open(outname, mode=('wb' if args.force else 'xb')) ValueError: invalid mode: xb

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "H:\Programs\pypy3-2.4.0-win32\lib-python\3\runpy.py", line 161, in _run_module_as_main "main", fname, loader, pkg_name) File "H:\Programs\pypy3-2.4.0-win32\lib-python\3\runpy.py", line 74, in _run_code exec(code, run_globals) File "C:\Users\null.Bytecode-Viewer\enjarify_2\enjarify-master\enjarify\main.py", line 94, in main() File "C:\Users\null.Bytecode-Viewer\enjarify_2\enjarify-master\enjarify\main.py", line 76, in main except FileExistsError: NameError: global name 'FileExistsError' is not defined

However with Python 3.4 it works fine, this is on Windows 7.

Is there maybe something I messed up on with BCV? If that's the case sorry for opening a ticket here, I just wasn't sure because Python 3.4 works perfectly fine, whereas PyPy3 doesn't.

Storyyeller commented 9 years ago

The problem is that FileExistsError wasn't introduced until 3.3, while the stable version of Pypy3 is only 3.2 compatible. While testing, I used a version of Pypy built from source, which is 3.3 compatible, so I didn't notice it until release.

It's a known issue, but I'm not sure what the best approach to resolving it is.

Storyyeller commented 9 years ago

See also the discussion in this pull request. https://github.com/google/enjarify/pull/6

Storyyeller commented 9 years ago

In the meantime, you can workaround it by always specifying -f.

Konloch commented 9 years ago

Ah ok, thank's for the response!

Storyyeller commented 9 years ago

I added an explicit error message when running under 3.2 without -f specified.