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

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

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?

commented: Good tip about importing +2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.