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..
user2357112 offers sound advice:
from importlib import util
Use instead e.g. from importlib import util as iutil and then iutil.spec_from_file_location().
Related
I am currently studying the Python socket library and wanted to try the recvmsg() function. After I imported * from the socket module I tried to call the function but it returns the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'recvmsg' is not defined
I tried to search for a solution on Google but did not found anything useful. Later I tried to call the function on my Linux machine too but returns the same error.
I am fairly new to working with RocksDB. I have set up the environment for RocksDB following the link here, but when I run a sample Python script having import rocksdb it says:
Traceback (most recent call last):
File "`<string>`", line 1, in <module>
ModuleNotFoundError: No module named 'rocksdb'
Can anybody suggest a solution to this issue?
So I spend last night trying to install nest (and pynest) to use with PyNN, and I am currently stuck. When I try to import nest I get:
>>> import nest
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nest/__init__.py", line 52, in <module>
from . import pynestkernel as _kernel
ImportError: cannot import name pynestkernel
However, when I make the make installcheck it passes all the pynest tests.
I am using OS x Yosemite, and I did a new install of python 2.7.9 using macport.
Tried:
easy_install python-nest
Now I am getting a new error.
Getting:
>>> import pyNN.nest as sim
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pyNN.nest as sim
File "/Library/Python/2.7/site-packages/pyNN/nest/__init__.py", line 13, in <module>
from pyNN.nest import simulator
File "/Library/Python/2.7/site-packages/pyNN/nest/simulator.py", line 500, in <module>
state = _State() # a Singleton, so only a single instance ever exists
File "/Library/Python/2.7/site-packages/pyNN/nest/simulator.py", line 60, in __init__
self._cache_num_processes = nest.GetKernelStatus()['num_processes'] # avoids blocking if only some nodes call num_processes
AttributeError: 'module' object has no attribute 'GetKernelStatus'
Try using setuptools to install nest with easy_install python-nest.
I am trying something similar, with the further goal of having it working with python 3. So far I used the following commands:
git clone https://github.com/nest/nest-simulator.git
cd nest-simulator
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/nest -DPYTHON_EXECUTABLE=/usr/local/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -DPYTHON_LIBRARY=/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/libpython3.5.dylib .
make
make install
which runs without errors and I can happily run nest. Iam still having troubles running pyNN (see https://laurentperrinet.github.io/sciblog/posts/2016-06-01-compiling-and-using-pynn-%2B-nest-%2B-python3.html)
I'm trying to run a simple code to test that I have installed correctly pyexiv2 in my computer. I'm using python 2.6.6. on windows 7 64 bit
So I run this simple code:
import pyexiv2
print pyexiv2.exiv2_version_info
and I get this error:
Traceback (most recent call last):
File "C:/Users/Usuario/Desktop/pyexiv2/pyexiv2.py", line 1, in <module>
import pyexiv2
File "C:\Users\Usuario\Desktop\pyexiv2\pyexiv2.py", line 3, in <module>
print pyexiv2.version_info
AttributeError: 'module' object has no attribute 'version_info'
How can I fix that? Thank you
You named your own file pyexiv2.py as well; rename it or delete it, as it is being imported instead of the installed module.
What would cause this strange error when trying to use the poplib.POP3_SSL class.
Traceback (most recent call last):
File "test.py", line 131, in <module>
M = poplib.POP3_SSL('XXXXXXXX', 995)
AttributeError: 'module' object has no attribute 'POP3_SSL'
My environment is Python 2.6, REHL5
I've never run into this problem before and it just so happens to be a problem with only one of my servers in rotation.
Your python might be compiled without ssl support.