Python and named pipes problem

Joined
Feb 26, 2008
Messages
1
Reaction score
0
I want to create a named pipe with python and write to it. But Python seems so freez everytime i want to open a pipe.

my code (exampel code found on http://my.opera.com/zomg/blog/2007/08/29/php-and-named-pipes):

import os

# the name of the pipe
pipeName = 'testpipe'

# we will get an error if the pipe exists
# when creating a new one, so try removing it first
try:
os.unlink(pipeName)
except:
pass

# create the pipe and open it for reading
os.mkfifo(pipeName)
pipe = open(pipeName,'r')

# read forever and print anything written to the pipe
while True:
data = pipe.readline()
if data != '':
print repr(data)


i try to run it "python pipe.py" and pyton creates the pipe correctly but after calling "pipe = open(pipeName,'r')" it just stops/freezes and i can do nothing. What's the Problem? Can andyone help me?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top