944,172 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Unsolved
  • Views: 3175
  • Python RSS
Jun 29th, 2006
0

Problem with win32pipe ...

Expand Post »
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 <DIR> .
29/06/06 03:28 PM <DIR> ..
29/06/06 02:11 PM <DIR> .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???
Last edited by xav.vijay; Jun 29th, 2006 at 7:49 am.
Similar Threads
Reputation Points: 10
Solved Threads: 6
Junior Poster in Training
xav.vijay is offline Offline
52 posts
since Aug 2005
Jun 29th, 2006
0

Re: Problem with win32pipe ...

Could be different level of XP upgrade. Early version of Window XP quite buggy!
Reputation Points: 404
Solved Threads: 180
Nearly a Posting Virtuoso
bumsfeld is offline Offline
1,422 posts
since Jul 2005
Jun 29th, 2006
0

Re: Problem with win32pipe ...

win32pipes are broken by definition, unfortunately. They won't work in all cases. I'd post a question to comp.lang.python (http://groups.google.com/group/comp.lang.python) where someone else should have experience working with/around plink specifically.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
TimothyFitz is offline Offline
2 posts
since Jun 2006
Jun 30th, 2006
0

Re: Problem with win32pipe ...

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:
Python Syntax (Toggle Plain Text)
  1. j = win32pipe.popen('"c:\\disk\\plink jnitin@10.94.101.178 -pw mat123 df -g"','r')
Also, if plink is plink.exe use extension.
Last edited by bumsfeld; Jun 30th, 2006 at 10:31 am.
Reputation Points: 404
Solved Threads: 180
Nearly a Posting Virtuoso
bumsfeld is offline Offline
1,422 posts
since Jul 2005
Jul 1st, 2006
0

Re: Problem with win32pipe ...

Thanks for the feedback .... Its probably due to XP, the code works fine with Win2K...
Reputation Points: 10
Solved Threads: 6
Junior Poster in Training
xav.vijay is offline Offline
52 posts
since Aug 2005
Jun 14th, 2010
0

Solved!!!

I managed to work around this problem adding this at the end of the command: "2>&1 0< nul:"

plink refuses to work without stdin redirected. It fails with the following error:

Unable to read from standard input: Invalid Identificator.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
luizfeliperj is offline Offline
1 posts
since Jun 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: python input validation
Next Thread in Python Forum Timeline: Inbox (Sender , Time ) problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC