I upgraded my IPython installation with pip, and when I use ipython, it failed like this:
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Shell'
But when I try $(which ipython), it starts up normally.
What may be the reason of that AttributeError?
Look under ~/.ipython. There's probably a configuration script there that is using the old API.
It turns out that an alias in .bashrc overrode ipython in $PATH, and it was set to be an old version of ipython
Related
So easy to reproduce that I'm surprised that nobody has reported it yet.
pip install wasmer
python -c 'from wasmer import ImportObject'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: cannot import name 'ImportObject' from 'wasmer' (/usr/lib/python3.8/site-packages/wasmer.cpython-38-x86_64-linux-gnu.so
"ImportObject" class is described in readme and presented in examples. I've checked that proper 0.4.1 version of "wasmer" was installed. Also I checked the newest tagged version of "wasmer" which fails with the same error. Do I do something totally wrong?
UPD: generate_import_object() function doesn't work also:
python -c "from wasmer import Module; Module.generate_import_object()"
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: type object 'Module' has no attribute 'generate_import_object'
And this code gives the same result:
wasm_bytes = open('binary.wasm', 'rb').read()
module = Module(wasm_bytes)
import_object = module.generate_import_object()
The library in pip is outdated. The current version is from March, 2nd, and the necessary changes were implemented only on June, 2nd. 0.4.2 beta version is outdated also (May, 19). So, the only way now is manual build. Probably the library will be updated in a couple of weeks.
See more details in this thread: https://github.com/wasmerio/python-ext-wasm/issues/215.
I'm trying to run an example found here, but it always fails to execute. After some debugging, I found out that the node.get_children() causes the exception, and here's the traceback:
Traceback (most recent call last):
File "_ctypes/callbacks.c", line 314, in 'calling callback function'
File "C:\Python27\lib\site-packages\clang\cindex.py", line 1383, in visitor
children.append(child)
AttributeError: 'str' object has no attribute 'append'
I'm using LLVM 4.0.1 on Windows, and I installed clang via pip (tried both clang3.5 and clang4.0.post1).
Here's my LD_LIBRARY_PATH: C:\Program Files\LLVM\bin, which I added into my
PATH like this: %LD_LIBRARY_PATH%;%PYTHONPATH%;...rest of path...
I got the same error after installing LLVM5.0 and cloning clang from github.
EDIT: I used Python2.7, but after switching to Python 3.6.3 everything works ok.
Switching to Python 3.6 solved the problem.
I have installed Python3.5 and ibis-framework 0.10.0. I want to operate Pandas data to impala database directly. But i meet the following error. Would you help me to solve it? The command line as following:
import ibis
conn = ibis.impala.connect(host='192.168.1.14', port=21050)
The error message as following:
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
conn = ibis.impala.connect(host='192.168.1.14', port=21050)
AttributeError: module 'ibis.impala' has no attribute 'connect'
it seems that you need to do this pip install ibis-framework[impala], see the link here ibis doc
it seems to have been moved in the ibis.impala.api submodule also if you would have to install hdfs otherwise it seems to fail
I'm trying to install and use ipdb (IPython-enabled pdb) on Python 3.3.5 32 bit on Win10 using PIP 8.1.2.
I've installed via PIP (had to install it seprately) in windows cmd with no errors:
pip install ipdb
I wrote a simple test script expecting to stop in debugger before printing 'test' string, ipdb_test.py:
import ipdb
ipdb.set_trace()
print('test')
When running it from IDLE editor the following exceptions show up:
Traceback (most recent call last):
File "C:\Python33.5-32\lib\site-packages\ipdb\__main__.py", line 44, in <module>
get_ipython
NameError: name 'get_ipython' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/temp/ipdb_test.py", line 1, in <module>
import ipdb
File "C:\Python33.5-32\lib\site-packages\ipdb\__init__.py", line 7, in <module>
from ipdb.__main__ import set_trace, post_mortem, pm, run # noqa
File "C:\Python33.5-32\lib\site-packages\ipdb\__main__.py", line 51, in <module>
(...)
File "C:\Python33.5-32\lib\site-packages\prompt_toolkit\terminal\win32_output.py", line 266, in flush
self.stdout.flush()
AttributeError: 'NoneType' object has no attribute 'flush'
As the issue seemed to be related to IPython, I've checked that the version installed while resolving ipdb dependencies was: "ipython-5.1.0".
The WA solution for the issue occured to be a fallback to version 4.2.1 of IPython:
pip install "ipython<5"
(...)
Successfully uninstalled ipython-5.1.0
Successfully installed ipython-4.2.1
After that ipdb halted on a breakpoint as expected:
$ python C:\temp\ipdb_test.py
WARNING: Readline services not available or not loaded.
WARNING: Proper color support under MS Windows requires the pyreadline library.
You can find it at:
http://ipython.org/pyreadline.html
Defaulting color scheme to 'NoColor'
> c:\temp\ipdb_test.py(3)<module>()
1 import ipdb
2 ipdb.set_trace()
----> 3 print('test')
ipdb>
It may be a valid case to contact the IPython project team on the issue, meanwhile I find an initial task of running a debug session completed.
I have lately installed python-git package, and when trying to follow the tutorials over at the following link, I find that certain methods are missing...
http://packages.python.org/GitPython/0.3.2/tutorial.html#tutorial-label
Here is what came out of my interpreter:
>>> from git import *
>>> repo = Repo.init('/home/deostroll/scripts/synchost')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'Repo' has no attribute 'init'
>>> repo = Repo('/home/deostroll/scripts/synchost')
>>> repo.is_dirty()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'bool' object is not callable
>>>
Those commands work for me, so I agree with the other answer that you're probably using an outdated version. If you're on linux and have PIP, installed, on the command line you can do:
pip install --upgrade GitPython
to upgrade to the latest version. (Sidenote: for me on Fedora, the command is actually pip-python, so it depends on your distro).
It seems likely that you're using a very outdated verison of GitPython. In version 0.3, is_dirty is a method, and init exists.
In version 0.1, is_dirty is a property, and init_bare is defined, but not init.