I have a problem very similar to this one but I’m not about using gcloud but I’m trying to run pyqtdeploy
.
I’m facing a strange problem: Running
>>> import importlib
>>> importlib.util.spec_from_file_location()
gives me
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'importlib' has no attribute 'util'
..using Python3.8.6 with importlib-1.0.4
running on a Debian 10 +testing
machine
while the exact same commands on Fedora 32 also running Python3.8.6 with importlib-1.0.4
let me use importlib.util
:
>>> importlib.util.spec_from_file_location()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: spec_from_file_location() missing 1 required positional argument: 'name'
Why can the exact same module have an attribute on one system and not on the other?
And how do I make pyqtdeploy
(and thus importlib.util
) work as expected?
Background: I’m currently trying to run pyqtdeploy
inside a Docker container but despite I’m using the same versions of Python and importlib
it will run on the Fedora host but not inside the container..
2
Answers
user2357112 offers sound advice:
Use instead e.g.
from importlib import util as iutil
and theniutil.spec_from_file_location()
.