From: cman122...@hotmail.com
To: roberto.c.agui...@gmail.com
Subject: RE: [python-win32] Python service needs to access network resources
Date: Wed, 20 Apr 2011 11:10:56 -0500










> Subject: Re: [python-win32] Python service needs to access network resources
> From: roberto.c.agui...@gmail.com
> Date: Tue, 19 Apr 2011 20:02:34 -0700
> CC: python-win32@python.org
> To: cman122...@hotmail.com
> 
> On Apr 19, 2011, at 5:48 PM, Chris Bennett wrote:
> > I have been trying to figure this out for weeks now.
> > I have made a simply Python service on my local computer, but it needs to 
> > import a module from the network.
> > I have tried appending the UNC of the folder to the path but it still says 
> > "there is no module named X"
> > Then when I tried running the service logged on as NT 
> > AUTHORITY\NetworkService it cannot find my service object, even if I point 
> > to it with UNC in the registry.
> > I am running out of ideas. Does anybody have any suggestions? Is it a 
> > firewall issue?
> > 
> > Windows XP. Python 2.5. 
> 

Thank you Roberto! Because of what you said I got it to work.
I was appending to the path outside of the the service class when i should have 
been appending it inside.

> Have you tried running the script that imports the module as a stand alone 
> program and _not_ as a service?  Can it access the network module?

 The script imports the module fine if it runs as a stand alone program. So yes 
it easily accesses the module, but I am logged in under a user that has that 
network device connected and mapped.
 
> Can os.listdir(unc_path) list the directory?

Yes it can when i run the service logged in under my user name.

> I assume, when you say appending the UNC to the path you mean sys.path?

Correct.

> Have you tried mapping the network drive to a drive letter and adding that to 
> the path?

^^^ THIS SUGGESTION LED ME TO THE ANSWER. When I tried to map the network drive 
outside the service class it threw an error saying it already existed. When I 
mapped the network drive and appended the path (appending the UNC worked too), 
I was able to use the module. much appreciated. This was making me quite 
aggravated.
 
> If the module is on the local machine does it import properly?

yes it does.

> -Roberto.
> 

-Chris
                                          
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to