943,871 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Unsolved
  • Views: 664
  • Python RSS
Jun 27th, 2009
0

trouble with import module...

Expand Post »
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...
Python Syntax (Toggle Plain Text)
  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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mbox_96 is offline Offline
9 posts
since Jun 2009
Jun 27th, 2009
0

Re: trouble with import module...

Since parallel is supposed to be a package, check if there is a file __init__.py in folder C:\\Python26\\Lib\\site-packages\\parallel
Reputation Points: 961
Solved Threads: 211
Nearly a Posting Maven
sneekula is offline Offline
2,413 posts
since Oct 2006
Jun 27th, 2009
1

Re: trouble with import module...

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?
Reputation Points: 462
Solved Threads: 392
Senior Poster
evstevemd is offline Offline
3,681 posts
since Jun 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: Check if var exists
Next Thread in Python Forum Timeline: My text game's file parser





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC