Problem with win32pipe ...
hi
I have a problem with the following code ...
>>> j = win32pipe.popen('c:\\disk\\plink jnitin@10.94.101.178 -pw mat123 df -g','r')
>>> for i in j:
print i
>>>
As you can see the file object 'j' does not have anything in it...
But if I type 'c:\disk\plink jnitin@10.94.101.178 -pw ibm123 df -g' in the DOS prompt, it works fine and gives me the required result...
So I gave a simple command via python like this...
>>> j = win32pipe.popen('dir','r')
>>> for i in j:
print i
Volume in drive C is DRIVE-C
Volume Serial Number is 5C8D-1DAC
Directory of C:\Disk
29/06/06 03:28 PM .
29/06/06 03:28 PM ..
29/06/06 02:11 PM .idlerc
06/06/06 11:29 AM 225,280 1suntemplate.xls
29/06/06 03:28 PM 14,848 29-6-2006.xls
.
.
19 File(s) 1,474,430 bytes
3 Dir(s) 27,306,981,376 bytes free
>>>
It works fine... but not the previous command....
But the same code executes perfectly on a different machine... Both have XP...
Can anybody help me ??? Why the same code is working on one machine & not in another???
xav.vijay
Junior Poster in Training
55 posts since Aug 2005
Reputation Points: 10
Solved Threads: 6
Could be different level of XP upgrade. Early version of Window XP quite buggy!
bumsfeld
Nearly a Posting Virtuoso
1,445 posts since Jul 2005
Reputation Points: 404
Solved Threads: 184
Maybe using the famous Microsoft kludge for handling spaces in filenames will do the trick. This wraps a pair of single quotes and double quote around the string. Try:
j = win32pipe.popen('"c:\\disk\\plink jnitin@10.94.101.178 -pw mat123 df -g"','r')
Also, if plink is plink.exe use extension.
bumsfeld
Nearly a Posting Virtuoso
1,445 posts since Jul 2005
Reputation Points: 404
Solved Threads: 184
Thanks for the feedback .... Its probably due to XP, the code works fine with Win2K...
xav.vijay
Junior Poster in Training
55 posts since Aug 2005
Reputation Points: 10
Solved Threads: 6