Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
ModuleNotFoundError with 'ansible_mitogen.target' #586
I've encountered a bit of a problem with Suitable and Mitogen that I don't quite know how to solve. When trying to connect from a Python3.6/3.7 host to a Python3.6 Ubuntu 18.04 vanilla installation I get the following error:
They key is this:
I know this might be related to Suitable's on hackery ending up in something that is like Ansible, but not quite like Ansible. So I'm not sure this is a Mitogen issue. But I'd be happy to get any pointers.
Especially, how can I check the importer debug logs?
I'm running with
What could be the cause of this error?
When you have the logging framework configured with
Unfortunately everything goes to the same logger right now, so it's not clear what the importer parts are -- but it is referring to the lines above. Before build_tuple() completes and prints those lines, a lot of complex machinery runs that should print errors of its own, if dependency scanning fails or if it was unable to find the source code for a module.
If you can point me at a reproduction I'll be happy to run this locally.
I was able to narrow this down somewhat in a separate test-case.
The weird thing is that it only happens if run inside a Python CLI, not when run as a script. Only in this test however, in the original case I encountered this, I had the same error in a script.
This is how you should be able to see the error. First, install dependencies:
pip install mitogen suitable ansible==2.7.11
Then, run the Python CLI:
Then paste the following code into the CLI:
import mitogen.utils from suitable.mitogen import Api mitogen.utils.log_to_file(level='DEBUG') Api('127.0.0.1').command('whoami')
I already set up a container and everything to test this out, but it turns out that there's no connection needed either. So I'm not sure why exactly this occurs when Python 2 is not on the host in my original error. But maybe this error just masks something else.
Hi @href, I hope to get to this one real soon. I'm so sorry for the wait, it's only the past week or so I've been able to spend serious time on the library again, and getting stuff merged to handle all of 2.8's features has been the priority. Naturally there has been a lot of fallout from doing a big merge
This issue is probably really simple, will try and get to it as soon as CI is reliably healthy
What joyful luck (for me, at least!)
The reason it only manifests in the interactive interpreter is because
Ansible 2.7 for inexplicable reasons changed
Meanwhile to cope with that,
Fast forward a little further, and sometime relatively recently in Python 3 land,
Unfortunately the new method was never written for
If you scroll up a good bit in the logs, you will see a
Soooo sorry for the huge delay on getting to this -- hopefully I'll have at least the next week to burn through more backlog. Master is approaching releasable, but it is a 7kLOC diff compared to 0.2.7 and needs at least a few nights of soak tests (depending on outcome of the previous night's run!) to get out the door
Thanks again for reporting this!