-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import from past
causes traceback
#209
Comments
the only time i see this type of problem is when an ImportError is caught and ignored, and them the same name is imported again somewhere else afterwards |
Hi @jayvdb can you eloborate on that a little bit more? An importerror relating to python future?? |
@jayvdb this error is thrown on NAS type devices as they won't have 2to3 compiled into python2.. Is it possible to maybe check for the existance for lib2to3 via a try catch block and disable the functions that use it if it does not exist? |
Yes, can we please reopen this - lib2to3 is clearly broken on NAS/Router devices. |
This seems like a good idea to me. Can someone comment on what these imports are actually doing? We are getting more reports of users that do not have the lib2to3 in their stdlib. |
Hi, I just received a reply on my question on lib2to3 over at Entware/Entware-ng#268 (comment). I believe the answer actually state that lib2to3 is not built into our python is because it's version 2. In my case, it's version 2.7. lib2to3 is a module which convert python 2 script to python 3 automatically (https://docs.python.org/2.7/library/2to3.html). So, it make sense that our python 2 doesn't include lib2to3. From what I see, by requiring lib2to3, you guys are removing support for python 2 automatically. Wasn't the purpose of lib2to3 is to support python 2 script in python 3? So, shouldn't a version check be done before importing lib2to3? Something like this perhaps?
Btw, I'm not a python coder, so the above code is just my assumption. |
Thanks for reporting this, Chase! @programatix : @gazpachoking, @stevezau: Yes, it would be possible for the |
For reference, as pyglet fails to run under Python 3.6 due to this problem, I worked around it using the following change in --- past/translation/__init__.py.orig 2017-09-24 08:23:47.646644743 +0200
+++ past/translation/__init__.py 2018-01-01 10:31:36.584576652 +0100
@@ -38,8 +38,32 @@
import os
import sys
import copy
-from lib2to3.pgen2.parse import ParseError
-from lib2to3.refactor import RefactoringTool
+
+try:
+ from lib2to3.pgen2.parse import ParseError
+
+except ImportError:
+
+ class ParseError(SyntaxError):
+ pass
+
+try:
+ from lib2to3.refactor import RefactoringTool
+
+except ImportError:
+
+ class RefactoringTool:
+
+ def __init__(self, *args, **kwargs):
+ self._args = [repr(a) for a in args]
+ self._args += ["{}={!r}".format(k, v) for k, v in kwargs.items()]
+
+ def __repr__(self):
+ return "{}({})".format(self.__class__.__name__, ", ".join(self._args))
+
+ def refactor_string(self, *args, **kwargs):
+ raise NotImplementedError("dummy RefactoringTool")
+
from libfuturize import fixes
|
There seems to be an issue (on some python installations) when importing from the
past
package. One of our users is reporting this traceback:Any ideas what's going on here? Downstream ticket, for referece: Flexget/Flexget#1093
The text was updated successfully, but these errors were encountered: