Python errors

Code junkies hangout here

Moderators: ChrisThornett, LXF moderators

Python errors

Postby RD » Sat Sep 03, 2005 2:44 pm

Hi

Im looking into taking over the quickrip project :D

how ever while my small mods work fine im still getting errors and have hit my head at a wall more times than i care to remember (may be just trired)

heres the problems

Code: Select all
Traceback (most recent call last):
  File "quickrip.py", line 61, in ?
    main(sys.argv[1:])
  File "quickrip.py", line 56, in main
    cli.main()
  File "cli/cli.py", line 430, in main
    cli.switch('front')
  File "cli/cli.py", line 44, in switch
    self.front()
  File "cli/cli.py", line 68, in front
    self.scanDVD()
  File "/home/drakx/quickrip-0.9-alpha/quickrip-0.9-alpha/base.py", line 197, in scanDVD
    self.raw_dvd = mmpython.parse(self.config['dvd_device'])
NameError: global name 'mmpython' is not defined


thats the errors i get :( here is the code snippets

File "quickrip.py", line 61:

Code: Select all
# The famous __name__ + __main__ trick...
if __name__ == '__main__':
 main(sys.argv[1:])


File "quickrip.py", line 56:

Code: Select all
# Fallback to CLI mode...
 sys.path.append("cli")
 import cli
 cli.main()
 sys.exit(2)


File "cli/cli.py", line 430

Code: Select all
def main():
 #print "QuickRip v0.6, (C) Tom Chance, 2003"
 print "%s v%s, %s\n" % (__app__, __version__, __copyright__)
 cli = CLI()
 cli.switch('front')


File "cli/cli.py", line 44:

Code: Select all
def switch(self, mode, title=1):
  """send user into various modes (entry, toplevel, title)"""
  os.system("clear")
  print output.bold("%s v%s, %s\n" % (__app__, __version__, __copyright__))
  if mode == 'front':
   self.level = 'front'
   self.front()
  elif mode == 'toplevel':
   self.level = 'toplevel'
   self.toplevel()
  elif mode == 'title':
   self.level = 'title'
   self.showTitle(title)
  elif mode == 'configure':
   self.level = 'configure'
   self.configure()
  elif mode == 'rip':
   self.level = 'ripping'
   self.ripScreen()


File "cli/cli.py", line 68:

Code: Select all
def front(self):
  """show the front screen"""
  print output.bold("\nHit enter to scan DVD")
  try:
   null = raw_input()
   del null
  except KeyboardInterrupt:
   print output.bold("\n\nExiting...")
   sys.exit(2)
  self.scanDVD()
  self.switch("toplevel")


base.py", line 197:

Code: Select all
# The following functions are threaded, but are processed in the order
 # in which they appear here. - biggs
 def scanDVD(self):
  """Scan the DVD and build up a data structure for the titles"""
  self.notify_startScanning()
  self.titles = []
  self.numtitles = 0

  # Reset values to default (in case user scans two different discs in same session)
  self.raw_dvd = mmpython.parse(self.config['dvd_device'])
 
  # If there aren't any titles...
  if self.raw_dvd.tracks == []:
   self.notify_noTitles()


any one any ideas why this is happening ? and how to correct it please

using python 2.4 and ubuntu
RD
LXF regular
 
Posts: 272
Joined: Mon Jul 25, 2005 2:53 am
Location: irc.ixl2.net

RE: Python errors

Postby RD » Sat Sep 03, 2005 11:31 pm

Hi i seem to be getting a syntak error and dont know why?

Code: Select all
python quickrip.py
  File "quickrip.py", line 43
    except getopt.GetoptError, msg:
    ^
SyntaxError: invalid syntax


here is the line it refers too

Code: Select all
def main(argv=None):
 if argv is None:
      argv = sys.argv
 try:
  try:
   opts, args = getopt.getopt(argv[1:], "hgca", ["help", "gtk", "cli", "autoresize"])
 except getopt.GetoptError, msg:
  raise usage(msg)
  sys.exit(2)


thanks
RD
LXF regular
 
Posts: 272
Joined: Mon Jul 25, 2005 2:53 am
Location: irc.ixl2.net

RE: Python errors

Postby RD » Sat Sep 03, 2005 11:49 pm

hmm after a lttle playing around i seem to have not got very far

Code: Select all
def main(argv=None):
 if argv is None:
  argv = sys.argv
      #try: # would seem if this is umcommented it throws errors right @ Fallback to CLI mode
  try:
   opts, args = getopt.getopt(argv[1:], "hgca", ["help", "gtk", "cli", "autoresize"]) #here added [1:] to argv
  except getopt.getoptError:
   usage()
   sys.exit(2)
  for opt, arg in opts:
   if opt in ("-h", "--help"):
    usage()
    sys.exit(2)
   elif opt in ("-c", "--cli"):
    sys.path.append("cli")
    import cli
    cli.main()
    sys.exit(2)

 # Fallback to CLI mode...
 sys.path.append("cli")
 import cli
 cli.main()
 sys.exit(2)

# The famous __name__ + __main__ trick...
if __name__ == '__main__':
 main(sys.argv[1:])


still complains about
Code: Select all
if __name__ == '__main__':
 main(sys.argv[1:])


also

Code: Select all
cli.main()


from fall back to CLI mode
RD
LXF regular
 
Posts: 272
Joined: Mon Jul 25, 2005 2:53 am
Location: irc.ixl2.net

RE: Python errors

Postby RD » Sun Sep 04, 2005 9:11 am

Fixed all the above errors
RD
LXF regular
 
Posts: 272
Joined: Mon Jul 25, 2005 2:53 am
Location: irc.ixl2.net


Return to Programming

Who is online

Users browsing this forum: Google [Bot] and 1 guest