cannot follow the python git tutorials - python

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.

Related

Can't import "ImportObject" from python "wasmer"

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.

no attribute 'contrib' for problems()

I am trying to see the available problems() but it is giving Error.
Can you please let me know if I am missing anything
>>> from tensor2tensor import problems
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\\Anaconda3\lib\site-packages\tensor2tensor\problems.py", line 22, in <module>
from tensor2tensor.utils import registry
File "C:\Users\\Anaconda3\lib\site-packages\tensor2tensor\utils\registry.py", line 551, in <module>
attacks = tf.contrib.framework.deprecated(None, "Use registry.attack")(attack)
AttributeError: module 'tensorflow' has no attribute 'contrib'
>>> tf.__version__
'2.0.0-beta1'
>>>
I am working on windows
Tensor2Tensor library is not yet compatible with Tensorflow 2.0 because it still uses a lot of deprecated APIs. Your only option currently is to downgrade to an older version, such as Tensorflow 1.15.
pip3 install tensorflow==1.15.0

Zbar on raspberry?

I'm trying use zbar on RPI3 but i have a problem. I dont have ImageScanner, Image... module.
import zbar
scanner = zbar.ImageScanner()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'ImageScanner'
I tried to install it from pip, official repository, some fork, but nothing work.
https://pastebin.com/ajbWdSct
how can i access image modul?
To list module content try to type:
import zbar
dir(zbar)
See example are in source https://github.com/npinchot/zbar/blob/master/examples/read_one.py

Python tensorflow error, sys has no attribute getdlflags

I Just attempted to install tensorflow for python and when I went to the console to see if the init.py was working it returned this error. I installed it manualy without pip or any other package manager.
>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\*username\AppData\Local\Programs\Python\Python35-32\lib\tensorflow\__init__.py", line 43, in <module>
_default_dlopen_flags = sys.getdlopenflags()
AttributeError: module 'sys' has no attribute 'getdlopenflags'
TensorFlow is not supported on Windows yet. Please follow this github issue which tracks TensorFlow Windows support.

Get AttributeError after upgrading to IPython13

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

Categories

Resources