trouble with import module...

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2009
Posts: 1
Reputation: mbox_96 is an unknown quantity at this point 
Solved Threads: 0
mbox_96 mbox_96 is offline Offline
Newbie Poster

trouble with import module...

 
0
  #1
Jun 27th, 2009
Hello everyone, I'm new to pyhton and this is my first post. Please help me understand how can I tell python where my parallel module is located. parallel module I think is located under parallel folder. Any help will be appreciated...
  1. import sys
  2. sys.path.append('C:\\Python26\\Lib\\site-packages\\parallel')
  3. class HelloWorld:
  4. _reg_clsid_ = '{BEA1AA48-1D0A-4D19-8E98-03C54F195B59}'
  5. _reg_desc_ = "Python Test COM Server"
  6. _reg_progid_ = "Python.TestServer"
  7. _public_methods_ = ['hello']
  8. _public_attrs_ = ['softspace', 'noCalls']
  9. _readonly_attrs_ = ['noCalls']
  10.  
  11. def __init__(self):
  12. self.softspace = 2
  13. self.noCalls = 0
  14.  
  15.  
  16. def hello(self, arg1):
  17. if arg1==1:
  18. sel="This is option 1 message from COM"
  19. elif arg1==2:
  20. sel="This is option 2 message from COM"
  21. elif arg1==3:
  22. sel="This is option 3 message from COM"
  23. # THIS IS WHERE I GET THE ERROR (no module found)
  24. import parallel
  25. p=parallel.Parallel()
  26. p.setData(arg1)
  27. arg1=sel
  28. return arg1
  29.  
  30.  
  31.  
  32. if __name__=='__main__':
  33. import win32com.server.register
  34. win32com.server.register.UseCommandLine(HelloWorld)
  35. import pythoncom
  36. print pythoncom.CreateGuid() # different each time
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 2,297
Reputation: sneekula has a spectacular aura about sneekula has a spectacular aura about 
Solved Threads: 178
sneekula's Avatar
sneekula sneekula is offline Offline
Nearly a Posting Maven

Re: trouble with import module...

 
0
  #2
Jun 27th, 2009
Since parallel is supposed to be a package, check if there is a file __init__.py in folder C:\\Python26\\Lib\\site-packages\\parallel
No one died when Clinton lied.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,474
Reputation: evstevemd has a spectacular aura about evstevemd has a spectacular aura about evstevemd has a spectacular aura about 
Solved Threads: 128
evstevemd's Avatar
evstevemd evstevemd is offline Offline
Nearly a Posting Virtuoso

Re: trouble with import module...

 
1
  #3
Jun 27th, 2009
if possible, just include it in same folder as your script and do a simple import as you did to sys. Otherwise, if correctly installed, then it should respond to simple import. Did you write the module or installed it from someone/somewhere?
Atheist: God is man made imagination, he doesn't exist!
Theist: It's okay, can you imagine anything else that doesn't exist?
---- Python, C++ PHP and Java ----
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Python
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC