0

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

import sys
sys.path.append('C:\\Python26\\Lib\\site-packages\\parallel')
class HelloWorld:
   _reg_clsid_ = '{BEA1AA48-1D0A-4D19-8E98-03C54F195B59}'
   _reg_desc_ = "Python Test COM Server"
   _reg_progid_ = "Python.TestServer"
   _public_methods_ = ['hello']
   _public_attrs_ = ['softspace', 'noCalls']
   _readonly_attrs_ = ['noCalls']
   
   def __init__(self):
     self.softspace = 2
     self.noCalls = 0
    
      
   def hello(self, arg1):
     if arg1==1:
        sel="This is option 1 message from COM"
     elif arg1==2:
        sel="This is option 2 message from COM"
     elif arg1==3:
        sel="This is option 3 message from COM"
        # THIS IS WHERE I GET THE ERROR (no module found)
        import parallel
        p=parallel.Parallel()
        p.setData(arg1)
     arg1=sel 
     return arg1

   

if __name__=='__main__':
   import win32com.server.register
   win32com.server.register.UseCommandLine(HelloWorld)
   import pythoncom
   print pythoncom.CreateGuid() # different each time
3
Contributors
2
Replies
7
Views
7 Years
Discussion Span
Last Post by Stefano Mtangoo
0

Since parallel is supposed to be a package, check if there is a file __init__.py in folder C:\\Python26\\Lib\\site-packages\\parallel

1

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?

Votes + Comments
Good tip about importing
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.