Udonse
Udonse

Reputation: 51

Why does this error message display each time I try to import git

I am new to GitPython. I try to import git after installing gitpython successfully,

import git

but it returns this error message :

 /data/data/org.qpython.qpy3/files/bin/qpython.sh "/storage/sdcard0/qpython/scripts/.last_tmp.py" && exit
qpython/scripts/.last_tmp.py" && exit <
Traceback (most recent call last):
  File 
"/storage/sdcard0/qpython/scripts/.last_tmp.py", 
line 1, in <module>
import git
File 
"/data/data/org.qpython.qpy3/files/lib/python3.2/site-packages/git/__init__.py", line 38, in <module>
from git.config import GitConfigParser  # 
@NoMove @IgnorePep8
File 
"/data/data/org.qpython.qpy3/files/lib/python3.2/site-packages/git/config.py", line 25, in <module>
from git.util import LockFile
  File   
"/data/data/org.qpython.qpy3/files/lib/python3.2/site-packages/git/util.py", line 568
return u'<git.Actor "%s <%s>">' % (self.name, self.email)
                              ^
SyntaxError: invalid syntax
1|u0_a131@g150_g:/ $

Why and how can I fix these. Thank you.

Upvotes: 0

Views: 376

Answers (1)

polku
polku

Reputation: 1590

That's an interesting situation, the syntax for unicode literals (u'foo') you see in the last line exists in Python 2 but has been introduced in Python 3 only in the 3.3 version (PEP 414). Since 3.2 is now 6 years old, it seems reasonable from library developers to expect users to have more modern versions and don't handle that specific situation.

So unless you have a very good reason not to, the easy solution is to use a more recent version of Python3.

If you really have no control on that and absolutely need this library, you'll probably have to patch it yourself.

Upvotes: 3

Related Questions