[python-win32] wrong results in service running mode

Michael Li mli at deform.com
Wed Apr 26 18:31:37 CEST 2006

Hi, Mark

Thank you very much for your reply.

Now I understand that Windows' "SYSTEM" account is not
the same as Unix's "root" account.

Finally I solved my problems based on Roger Upole's suggestions.

Here is what I did:
in client side, I use WNetEnumResource to get mapped share name,
then I send "shared" to the remote(server) computer.
in server(remote) side, I use win32net.NetShareEnum to compare
"shared" and get the local path.

I still have the same problem in a Windows/Linux mixed environment.
Do you have any idea to get local path in linux from Windows' side ?

Mark, your Win32 extension is very useful and easy to use,
you are genius, thank you thank you very very much.

Best regards.
Michael Li

Mark Hammond wrote:
>>One piece of the program is to check a file exist or not as follows:
>>         szNormPath= os.path.normpath(strFileName)
>>         nRetCode = os.access(szNormPath, os.F_OK)
>>         # nRetCode = os.path.exists(szNormPath)
>>When the file path is C:\shared\t.txt, no problem.
>>When the path becomes L:\t.txt, then I got problems:
>>nRetCode always is False(0), here L: is a mapped drive
>>L: = C:\shared. So L:\t.txt and C:\shared\t.txt
>>point to the same file.
> This is almost an FAQ for services and has nothing to do with Python.
> When running from a DOS box, the service is running as your user, so has all
> your drive mappings etc.  When running as a service it generally runs as a
> different user, so does not.  Worse, the LocalSystem account generally has
> no network access.
> The solution is generally just to use the complete UNC name '\\server\share'
> in your Python program - this generally works fine (but still will generally
> *not* work for the LocalSystem account - so you will also need to change the
> username)
> Cheers,
> Mark

This email message and any attachments are for the sole use of the intended recipients and may contain proprietary and/or confidential information which may be privileged or otherwise protected from disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipients, please contact the sender by reply email and destroy the original message and any copies of the message as well as any attachments to the original message.

More information about the Python-win32 mailing list