enochcheng / git-repo

Automatically exported from code.google.com/p/git-repo
Apache License 2.0
0 stars 0 forks source link

Python ERROR INVALID SYNTAX #97

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
[root@host direc]# repo
  File "/bin/repo", line 175
    except OSError, e:
                  ^
SyntaxError: invalid syntax

Python is the worst language, you should use C++ or JAVA. Or you have to learn 
python for a bit :)

Original issue reported on code.google.com by pzalas1...@gmail.com on 26 Nov 2011 at 2:26

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Here is quickfix:

1.Open repo file in vim or other editor then find line 180. Replace code with 
this:

except OSError:
      print >>sys.stderr, \
            'fatal: cannot make %s directory' % (
            repodir)

2. In line 253:

except OSError:
      print >>sys.stderr, \
            'fatal: cannot make %s directory' % (
            home_dot_repo)

3.In line 259:

  if not os.path.isdir(gpg_dir):
    try:
      os.mkdir(gpg_dir)
    except OSError:
      print >>sys.stderr, \
            'fatal: cannot make %s directory' % (
            gpg_dir)
      sys.exit(1)

4. Line 276:

except OSError:

5. Line 376:
except urllib2.HTTPError as e:

6.Line 382:
except urllib2.URLError as e:

7. Line 411:
except OSError as e:

8. Line 420:
except OSError as e:

9 Line 683:
except OSError as e:

Original comment by pzalas1...@gmail.com on 22 Dec 2011 at 3:22

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
QUICKFIX part 2:
1.Line 94:
import urllib

Sorry, I have never learnt python, so in this error I can't help you:

Traceback (most recent call last):
  File "/bin/repo", line 690, in <module>
    main(sys.argv[1:])
  File "/bin/repo", line 641, in main
    cmd, opt, args = _ParseArguments(orig_args)
  File "/bin/repo", line 546, in _ParseArguments
    for i in xrange(0, len(args)):
NameError: global name 'xrange' is not defined

Original comment by pzalas1...@gmail.com on 22 Dec 2011 at 3:30

GoogleCodeExporter commented 9 years ago
I tried applying these quick fixes, but now I get the following error when 
trying to INIT a gingerbread repo:

File "/bin/repo", line 175
    except OSError:
         ^
SyntaxError: invalid syntax

Original comment by sleepdre...@gmail.com on 24 Dec 2011 at 2:01

GoogleCodeExporter commented 9 years ago
Ok, I got that last error worked around, turns out I copied the script wrong 
and the tabs and indentation got messed up, had to redownload the original 
script and make the changes directly to it instead of copy-pasting the text 
blocks.

But now I am getting the errors shown above:

Traceback (most recent call last):
  File "~/bin/repo", line 690, in <module>
    main(sys.argv[1:])
  File "~/bin/repo", line 641, in main
    cmd, opt, args = _ParseArguments(orig_args)
  File "~/bin/repo", line 546, in _ParseArguments
    for i in xrange(0, len(args)):
NameError: global name 'xrange' is not defined

Does anyone have any ideas? I've been trying to debug it, so far I know that 
"xrange" is a built-in function in some python versions...

Original comment by sleepdre...@gmail.com on 26 Dec 2011 at 11:52

GoogleCodeExporter commented 9 years ago
Just a word out to anyone experiencing these issues, I have managed to get this 
working by uninstalling python3 and installing/leaving python 2.7 and creating 
a symlink (if it 's not there already) to python2 on /usr/bin/python

ln -s /usr/bin/python2 /usr/bin/python

Original comment by sleepdre...@gmail.com on 27 Dec 2011 at 12:31

GoogleCodeExporter commented 9 years ago
Issue 98 is the answer :)

Original comment by pzalas1...@gmail.com on 27 Dec 2011 at 6:16

GoogleCodeExporter commented 9 years ago

Original comment by cco3@android.com on 7 Aug 2012 at 7:43