-
Notifications
You must be signed in to change notification settings - Fork 199
master: plumbum.colours installs junk in sys.modules #310
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
Comments
Thanks for the report! The importer took quite a beating during the Python 3 work, this should hopefully be a simple fix. Will look at it closer in the coming days. |
I've pushed a fix in b5c7a440a1d9a23c9db89aec7d7652cc2e36d5ca, but it's not on master yet. Feel free to cherry-pick this if you're playing locally, otherwise give me a few days and it'll be part of the next release. :) Thanks for reporting! |
On 3.x, Importer() can still have its methods called even if load_module() raises ImportError. Closes #310.
Those import errors are pretty annoying -- potentially I could make them warnings instead, but that doesn't help much, since presently IoLogger (stdout/stderr of the children) are logged at the INFO level, so we can't set the default level to ERROR to hide them by default. |
Agreed, …And, wonderful! This does indeed appear to fix the issue with In fact, here is the result of a working draft of that integration (with
– (where, of course, I'm using Unfortunately, I've got another one for you; though, it's not from the standard library, (and looking it over, I can only imagine…) – In the script,
– the line,
Note, this is not reproducible with the Since |
Whups, didn't intend to close this, there is still some other stuff remaining |
So the problem is that plumbum installs crap in sys.modules. There used to be a third strategy to handle this but I ripped it out. Will rename this bug and look at it later. In general, there's not much to be done for modules that intentionally braindamage the interpreter, other than calling it out for what it is. :( However, that does not mean a heuristic wouldn't have handled this case, so I still consider it something worth fixing. |
The relevant code is |
I /think/ I ripped it out because I could no longer find a use for it any more -- at some stage it was needed, I think, for 'six.moves'. |
Just as an update, I can confirm that the Importing Thanks again. |
Currently getting something like this still, my target is a Ubuntu Bionic system with Python 3.6.6. The source is an OS X system with 3.7.0, mitogen is 0.2.3 https://gist.github.com/mpdehaan/035820f9c2322fe659178faa87ae033d |
- don't try anything unless something really lives in sys.modules by that name - non-ASCII files are possible - the unimportable thing might be an extension module, we don't want that
Sorry about the huge delay on this one, all fixed now. :) |
This is now on the master branch and will make it into the next release. To be updated when a new release is made, subscribe to https://networkgenomics.com/mail/mitogen-announce/ Thanks for reporting this! |
Changing VPN IP for bhr-man1-s1-viacloud
A script running mitogen which attempts to import
pathlib
raises an uncaughtTypeError
(exposed asCallError
).Removing the line –
– from my script resolves the issue.
I'm just getting started with mitogen, and really excited about it! Not only does it vastly improve our experience with Ansible; moreover, I'd like to integrate it as an extension to a high-level command (hierarchy) library, argcmdr, such that programmers at my organization can contribute to devops in whatever way suits them and their needs best (even pure Python), and such that they needn't worry per-command about remote connections or deployment.
I'm happy to see that this does work, so far, at least against the local context; except, if my command depends upon the Python 3 standard library
pathlib
, it fails.Rather than include the full target code, here is an example proof,
fake_manage.py
:Executing the above script results in the below error output:
As for
pathlib
, or reallyntpath
, it attempts to importnt
, but anticipates anImportError
for this import on non-Windows systems. I spent some time tracing howmitogen
handles (or mishandles) this case, but didn't come up with much of anything.The text was updated successfully, but these errors were encountered: