You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a question regarding simplejson's intra-package import statements. For example, in decoder.py, there is the statement--
from simplejson.scanner import make_scanner
It seems like this prevents simplejson from being used without installing it. If I drop the simplejson package into my project at the location thirdparty/simplejson and use the import statement--
from thirdparty import simplejson as json
then I get the following error at that line of decoder.py:
ImportError: No module named simplejson.scanner
Is there a way to use simplejson in the way that I'm trying without getting that error? If you used relative imports of the form
from scanner import make_scanner # or
from .scanner import make_scanner
then it seems like this would not be a problem. I know that PEP 8 discourages the use of relative imports, but for the reason above, I've never understood its rationale for packages where the package owner does not have control over how the package will be used. Thanks in advance for your help.
If you submit a pull requests with tests for this I would consider it, but there are other ways to do what you're doing that don't require changing the namespace. Note that it may even require changes to the C code to support this, because it imports Python code.
Activity
etrepum commentedon Apr 19, 2011
If you submit a pull requests with tests for this I would consider it, but there are other ways to do what you're doing that don't require changing the namespace. Note that it may even require changes to the C code to support this, because it imports Python code.
modified: ts/bin/bt