[python-win32] how to know the native file path of computer A on computer B

Michael Li mli at deform.com
Tue Mar 21 22:31:28 CET 2006


I forgot to mention that:
W: on computer B is a mapped network drive, which is
C:\shared on computer A.
So W:\database\test.DB on computer B and
C:\shared\database\test.DB on computer A are
pointed to the same file.
 From computer B, I only know the file path is
W:\database, when the program actually runs
on computer A, I need to know the real file path
C:\shared\database on computer A.

The folder itself is not the fixed, it might be
D:\aaa, also the mapped drive path is not fixed,
it might be X:\bbb.

Michael Li wrote:
> Hi,
> I got bunch of reply, thank you very much.
> But they are not what i want.
> Let me make it more clear, my code looks like:
> 
>     nRetCode = os.access(szFolder, os.F_OK)
>     if nRetCode == 1:
>         nRetCode = os.chdir(szFolder)
>         szNormPath = os.path.normpath(szCommand)
>         szBatchFile = szNormPath
>         anArgs = [szBatchFile, 'NDEBUG']
>         nRetCode = os.spawnv(os.P_NOWAIT, szBatchFile, anArgs)
> 
> The above code is on the computer A where python server
> is running. The szFolder must be "C:\shared\database", not
> "W:\database", because "W:" does not exist on computer A,
> "W:" is on computer B.
> 
> Right now, szFolder comes from computer B as an argument inputed
> on computer B, I want to make szFolder auto-decide if possible.
> Any ideas ?
> 
> Best regards.
> Michael Li
> 
> 
> Michael Li wrote:
> 
>> Hi, all
>>
>> I want to run a command remotely, but I have to know
>> the native file path on the remote computer from client
>> computer. Here is the details:
>>
>>   ------------------------------  ---------------------------
>>   |                            |  |                         |
>>   |       computer A           |  |    computer B           |
>>   |                            |  |                         |
>>   | C:\shared\database\test.DB |  |  W:\database\test.DB    |
>>   |                            |  |                         |
>>   |   python server            |  |    client               |
>>   |                            |  |                         |
>>   |                            |  |                         |
>>   -----------------------------   ---------------------------
>>                /|\                           /|\
>>                 |                             |
>>                 |-----------------------------|
>>
>>  From computer B, I send a command to computer A.
>> On computer A, python.exe is running 24X7 as a service.
>> When the pyhton server receives the command, it will go into
>> folder C:\shared\database and lunch another program.
>> Now I have to input native path on computer B, and pass
>> the native file path as an argument with the command and send together
>> to computer A. Then the python server knows where to go.
>> I am wondering that is it possible to know the native file path of
>> computer A on computer B ?
>> If possible, is there anyone point me a direction how to do it?
>> This may not be a python question, anyway I asked here, any C/C++/C#
>> programs are ok.
>> Thank you very much.
>>
>> Best regards.
>> Michael Li
>>
>> ==========
>> 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.
>>
>> _______________________________________________
>> Python-win32 mailing list
>> Python-win32 at python.org
>> http://mail.python.org/mailman/listinfo/python-win32
> 
> 
> 

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