Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Python errors

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming
View previous topic :: View next topic  
Author Message
RD
LXF regular


Joined: Mon Jul 25, 2005 3:53 am
Posts: 272
Location: irc.ixl2.net

PostPosted: Sat Sep 03, 2005 3:44 pm    Post subject: Python errors Reply with quote

Hi

Im looking into taking over the quickrip project Very Happy

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:
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 Sad here is the code snippets

File "quickrip.py", line 61:

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


File "quickrip.py", line 56:

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


File "cli/cli.py", line 430

Code:

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:
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:

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:

# 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
Back to top
View user's profile Send private message Visit poster's website
RD
LXF regular


Joined: Mon Jul 25, 2005 3:53 am
Posts: 272
Location: irc.ixl2.net

PostPosted: Sun Sep 04, 2005 12:31 am    Post subject: RE: Python errors Reply with quote

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

Code:

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


here is the line it refers too

Code:

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
_________________
[url=irc://irc.ixl2.org/ixl2]irc.ixl2.org[/url]
Back to top
View user's profile Send private message Visit poster's website
RD
LXF regular


Joined: Mon Jul 25, 2005 3:53 am
Posts: 272
Location: irc.ixl2.net

PostPosted: Sun Sep 04, 2005 12:49 am    Post subject: RE: Python errors Reply with quote

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

Code:

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:

if __name__ == '__main__':
 main(sys.argv[1:])


also

Code:
cli.main()


from fall back to CLI mode
_________________
[url=irc://irc.ixl2.org/ixl2]irc.ixl2.org[/url]
Back to top
View user's profile Send private message Visit poster's website
RD
LXF regular


Joined: Mon Jul 25, 2005 3:53 am
Posts: 272
Location: irc.ixl2.net

PostPosted: Sun Sep 04, 2005 10:11 am    Post subject: RE: Python errors Reply with quote

Fixed all the above errors
Back to top
View user's profile Send private message Visit poster's website
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast