473,395 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Vista + Rails 2.0 upgrade => subprocess hangs

Here's a small Python program I use to grab the output from rake:

=====

from subprocess import Popen, PIPE

p = Popen(args='c:\\ruby\\bin\\ruby.exe c:\\ruby\\bin\\rake -T',
cwd=u'c:\\Users\\ericp\\testing\\file07',
shell=True,
stdin=None,
stderr=PIPE,
stdout=PIPE,
creationflags=0x8000000
);
p.wait()
data = p.stdout.read()
print data

=====

This is on Windows Vista. With Rails 1.2.6 there was no problem.
After
upgrading to Rails 2.0.1, the program now hangs at the call to the
wait()
command. If I manually kill the ruby.exe process, I get some of the
expected
output, but not all of it.

I can run the above command from the command-line with no problem.

The rake code that Ruby loads did change moving from 1.2.6 to 2.0.1,
but
subprocess should run the command to completion.

I'm not sure what happens yet on XP, or other platforms. I'd like to
get this
working on Vista, though. Any ideas.

Thanks,
Eric
Dec 13 '07 #1
5 2144
Eric Promislow wrote:
Here's a small Python program I use to grab the output from rake:

=====

from subprocess import Popen, PIPE

p = Popen(args='c:\\ruby\\bin\\ruby.exe c:\\ruby\\bin\\rake -T',
cwd=u'c:\\Users\\ericp\\testing\\file07',
shell=True,
stdin=None,
stderr=PIPE,
stdout=PIPE,
creationflags=0x8000000
);
p.wait()
data = p.stdout.read()
print data
Your usage of wait() is dangerous. The code can block indefinitely when
the stdout or stderr buffer is full.

Christian
Dec 13 '07 #2
Eric Promislow wrote:
Here's a small Python program I use to grab the output from rake:

=====

from subprocess import Popen, PIPE

p = Popen(args='c:\\ruby\\bin\\ruby.exe c:\\ruby\\bin\\rake -T',
cwd=u'c:\\Users\\ericp\\testing\\file07',
shell=True,
stdin=None,
stderr=PIPE,
stdout=PIPE,
creationflags=0x8000000
);
p.wait()
data = p.stdout.read()
print data
Your usage of wait() is dangerous. The code can block indefinitely when
the stdout or stderr buffer is full.

Christian

Dec 13 '07 #3
>
Your usage of wait() is dangerous. The code can block indefinitely when
the stdout or stderr buffer is full.

Christian
That's what it is. `rake -T` returns more data in Rails 2.0.1
than it did in 1.2.6 -- cross-language breakage logically explained.
Thank you, Christian.

- Eric
Dec 13 '07 #4
Eric Promislow wrote:
>Your usage of wait() is dangerous. The code can block indefinitely when
the stdout or stderr buffer is full.

Christian

That's what it is. `rake -T` returns more data in Rails 2.0.1
than it did in 1.2.6 -- cross-language breakage logically explained.
Thank you, Christian.
You can use stdout, stderr = p.communicate() but keep in mind that the
data is buffered in memory. I suggest a temporary file if you expect
more than a couple of MB.

Christian
Dec 13 '07 #5
Eric Promislow wrote:
>Your usage of wait() is dangerous. The code can block indefinitely when
the stdout or stderr buffer is full.

Christian

That's what it is. `rake -T` returns more data in Rails 2.0.1
than it did in 1.2.6 -- cross-language breakage logically explained.
Thank you, Christian.
You can use stdout, stderr = p.communicate() but keep in mind that the
data is buffered in memory. I suggest a temporary file if you expect
more than a couple of MB.

Christian

Dec 13 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

42
by: kenneth.m.mcdonald | last post by:
First, I don't intend this to be a flame war, please. Python and Ruby are the only two languages I'd willingly work in (at least amongst common languages), and TurboGears and Rails seem roughly...
11
by: Don | last post by:
QUESTIONS: 1. Has anyone figured out how to successfully install the Office 97 Pro Service Release 2 patch in Vista? 2. Has anyone successfully installed an Office 97 Pro CD (SR2 version) in...
9
by: Phoe6 | last post by:
Hi all, Consider this scenario, where in I need to use subprocess to execute a command like 'ping 127.0.0.1' which will have a continuous non- terminating output in Linux. # code # This...
6
by: gregpinero | last post by:
Let's say I have this Python file called loop.py: import sys print 'hi' sys.stdout.flush() while 1: pass And I want to call it from another Python process and read the value 'hi'. How...
12
by: bhunter | last post by:
Hi, I've used subprocess with 2.4 several times to execute a process, wait for it to finish, and then look at its output. Now I want to spawn the process separately, later check to see if it's...
1
by: Marko Rauhamaa | last post by:
This tiny program hangs: ======================================================================== #!/usr/bin/env python import subprocess a = subprocess.Popen('cat',shell = True,stdin =...
7
by: skunkwerk | last post by:
Hi, i'm trying to call subprocess.popen on the 'rename' function in linux. When I run the command from the shell, like so: rename -vn 's/\.htm$/\.html/' *.htm it works fine... however when I...
4
by: grayaii | last post by:
There are so many threads on this subject, but I ran across a situation on Windows that I can't figure out. I'm trying to run this little command-line exe and when I launch like this, it hangs:...
0
by: Christian Heimes | last post by:
Kenneth McDonald wrote: The subprocess module has already an API method for your use case. The communicate() method of a subprocess.Popen instance takes an optional stdin string and returns the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.