John Nagle wrote:
>I'm starting to think that the "cpickle" module, which Python 3
> uses by default, has a problem. After the program has been
> running for a while, I start seeing errors such as
>
> File "C:\projects\sitetruth\InfoSiteRating.py", line 200, in scansite
> if len(self.ba
On 3/12/2015 5:18 PM, John Nagle wrote:
> On 3/12/2015 2:56 PM, Cameron Simpson wrote:
>> On 12Mar2015 12:55, John Nagle wrote:
>>> I have working code from Python 2 which uses "pickle" to talk to a
>>> subprocess via stdin/stdio. I'm trying to make that work in Python
>>> 3.
I'm starting to
On 3/12/2015 2:56 PM, Cameron Simpson wrote:
> On 12Mar2015 12:55, John Nagle wrote:
>> I have working code from Python 2 which uses "pickle" to talk to a
>> subprocess via stdin/stdio. I'm trying to make that work in Python
>> 3. First, the subprocess Python is invoked with the "-d' option, so
>
John Nagle wrote:
> I have working code from Python 2 which uses "pickle"
> to talk to a subprocess via stdin/stdio. I'm trying to
> make that work in Python 3.
>
> First, the subprocess Python is invoked with the "-d' option,
> so stdin and stdio are supposed to be unbuffered binary streams
On 12Mar2015 12:55, John Nagle wrote:
I have working code from Python 2 which uses "pickle"
to talk to a subprocess via stdin/stdio. I'm trying to
make that work in Python 3.
First, the subprocess Python is invoked with the "-d' option,
so stdin and stdio are supposed to be unbuffered binary
I have working code from Python 2 which uses "pickle"
to talk to a subprocess via stdin/stdio. I'm trying to
make that work in Python 3.
First, the subprocess Python is invoked with the "-d' option,
so stdin and stdio are supposed to be unbuffered binary streams.
That was enough in Python 2,
feredReader/Writer around that, then constructs a TextIOWrapper with UTF-16
or the default encoding around that. At startup, you just do that for the three
GetStdHandle handles, and that's your stdin, stdout, and stderr.
Besides not being reusable enough for people who want to wrap HANDLEs from
On Mon, Nov 18, 2013, at 7:33, Robin Becker wrote:
> UTF-8 stuff
This doesn't really solve the issue I was referring to, which is that
windows _console_ (i.e. not redirected file or pipe) I/O can only
support unicode via wide character (UTF-16) I/O with a special function,
not via using byte-based
On 18/11/2013 15:25, Victor Stinner wrote:
Why do you need to force the UTF-8 encoding? Your locale is not
correctly configured?
It's better to set PYTHONIOENCODING rather than replacing
sys.stdout/stderr at runtime.
There is an open issue to add a TextIOWrapper.set_encoding() method:
http://bu
Why do you need to force the UTF-8 encoding? Your locale is not
correctly configured?
It's better to set PYTHONIOENCODING rather than replacing
sys.stdout/stderr at runtime.
There is an open issue to add a TextIOWrapper.set_encoding() method:
http://bugs.python.org/issue15216
Victor
--
https://
On 18 Nov 2013 22:36, "Robin Becker" wrote:
>
> On 18/11/2013 11:47, Robin Becker wrote:
> ...
>>
>> #c:\python33\lib\site-packages\sitecustomize.py
>> import sys, codecs
>> sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
>> sys.stderr = codecs.getwriter("utf-8")(sys.stderr.det
On 18/11/2013 11:47, Robin Becker wrote:
...
#c:\python33\lib\site-packages\sitecustomize.py
import sys, codecs
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
sys.stderr = codecs.getwriter("utf-8")(sys.stderr.detach())
it seems that the above needs extra stuff to ma
On 15/11/2013 18:16, random...@fastmail.us wrote:
Of course, the real solution to this issue is to replace sys.stdout on
windows with an object that can handle Unicode directly with the
WriteConsoleW function - the problem there is that it will break code
that expects to be able to use sys.stdout
Of course, the real solution to this issue is to replace sys.stdout on
windows with an object that can handle Unicode directly with the
WriteConsoleW function - the problem there is that it will break code
that expects to be able to use sys.stdout.buffer for binary I/O. I also
wasn't able to get th
jonny lowe writes:
> The result is the same as before. I've tested in fedora11.
I don't think script is the answer here, since it only stores what's
displayed on a terminal and your program's input comes from a file and
is not displayed on the terminal.
Simplest solution is probably that you ha
On Feb 5, 11:10 pm, "Gabriel Genellina"
wrote:
> En Fri, 05 Feb 2010 17:39:07 -0300, jonny lowe
> escribió:
>
>
>
>
>
> > On Feb 4, 8:20 pm, exar...@twistedmatrix.com wrote:
> >> On 01:56 am, jonny.lowe.12...@gmail.com wrote:
> >> >What I want is to have an easy way tomergeinput.txt and thestdout
En Fri, 05 Feb 2010 17:39:07 -0300, jonny lowe
escribió:
On Feb 4, 8:20 pm, exar...@twistedmatrix.com wrote:
On 01:56 am, jonny.lowe.12...@gmail.com wrote:
>What I want is to have an easy way to merge input.txt and thestdout
>so that output.txt look like:
>Enter a number: 42
>You entered 42
On Feb 4, 8:20 pm, exar...@twistedmatrix.com wrote:
> On 01:56 am, jonny.lowe.12...@gmail.com wrote:
>
>
>
> >Hi everyone,
>
> >Is there an easy way to mergestdinandstdout? For instance suppose I
> >havescriptthat prompts for a number and prints the number. If you
> >execute this with redirection f
On 01:56 am, jonny.lowe.12...@gmail.com wrote:
Hi everyone,
Is there an easy way to merge stdin and stdout? For instance suppose I
have script that prompts for a number and prints the number. If you
execute this with redirection from a file say input.txt with 42 in the
file, then executing
./my
Hi everyone,
Is there an easy way to merge stdin and stdout? For instance suppose I
have script that prompts for a number and prints the number. If you
execute this with redirection from a file say input.txt with 42 in the
file, then executing
./myscript < input.txt > output.txt
the output.txt m
> $ cat utf8_from_stdin.py
> import sys
> data = sys.stdin.read()
> print "length of data =", len(data)
sys.stdin is a byte stream in Python 2, not a character stream.
To make it a character stream, do
sys.stdin = codecs.getreader("utf-8")(sys.stdin)
HTH,
Martin
--
http:/
Chris wrote:
> On May 28, 11:08 am, [EMAIL PROTECTED] wrote:
>> Say I have a file, utf8_input, that contains a single character, é,
>> coded as UTF-8:
>>
>> $ hexdump -C utf8_input
>> c3 a9
>> 0002
[...]
> weird thing is 'c3 a9' is é on my side... and copy/pasting the é
> gives me 'e
> Shouldn't you do data = data.decode('utf8') ?
Yes, that's it! Thanks.
-- dave
--
http://mail.python.org/mailman/listinfo/python-list
On May 28, 11:08 am, [EMAIL PROTECTED] wrote:
> Hi,
>
> I have problems getting my Python code to work with UTF-8 encoding
> when reading from stdin / writing to stdout.
>
> Say I have a file, utf8_input, that contains a single character, é,
> coded as UTF-8:
>
> $ hexdump -C utf8_input
>
[EMAIL PROTECTED] writes:
> Hi,
>
> I have problems getting my Python code to work with UTF-8 encoding
> when reading from stdin / writing to stdout.
>
> Say I have a file, utf8_input, that contains a single character, é,
> coded as UTF-8:
>
> $ hexdump -C utf8_input
> c3 a9
Hi,
I have problems getting my Python code to work with UTF-8 encoding
when reading from stdin / writing to stdout.
Say I have a file, utf8_input, that contains a single character, é,
coded as UTF-8:
$ hexdump -C utf8_input
c3 a9
0002
If I read this file by
On 1/21/2008 9:02 AM, Bernard Desnoues wrote:
> Hi,
>
> I've got a problem with the use of Redmon (redirection port monitor). I
> intend to develop a virtual printer so that I can modify data sent to
> the printer.
FWIW: there is a nice update the RedMon (v1.7) called RedMon EE (v1.81)
availab
On 1/22/2008 8:54 AM, Konstantin Shaposhnikov wrote:
> Hi,
>
> This is Windows bug that is described here:
> http://support.microsoft.com/default.aspx?kbid=321788
>
> This article also contains solution: you need to add registry value:
>
> HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVe
Sorry, I meant:
Alternatively you can use following command
cat file | python script.py
instead of
cat file | script.py
On Jan 22, 1:54 pm, Konstantin Shaposhnikov <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> This is Windows bug that is described
> here:http://support.microsoft.com/default.asp
Hi,
This is Windows bug that is described here:
http://support.microsoft.com/default.aspx?kbid=321788
This article also contains solution: you need to add registry value:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies
\Explorer
InheritConsoleHandles = 1 (REG_DWORD type)
Well, that's at least weird. I did test my code with Python 2.5 on Win
XP, using the command prompt. But testing it with IDLE gives exactly the
same error Bernard has. So apparently STDIN can't be accessed with IDLE.
Rolf
John Machin wrote:
>
> Excuse me, gentlemen, may I be your referee *befor
On Jan 22, 8:42 pm, Bernard Desnoues <[EMAIL PROTECTED]>
wrote:
> Hello,
>
> I checked under linux and it works :
> text.txt :
> "first line of the text file
> second line of the text file"
>
> test.py :
> "import sys
> a = sys.stdin.readlines()
> x = ''.join(a)
> x = x.upper()
> sys.stdout.write(x
x.upper()
> sys.stdout.write(x)"
>
> >cat text.txt | python test.py
>
> But I reinstalled Python 2.5 under Windows XP and it doesn't work
> anyway. Can you confirm that your script works with Win XP and Python 2.5 ?
How are you invoking the script under WinXP? If you
Hello,
I checked under linux and it works :
text.txt :
"first line of the text file
second line of the text file"
test.py :
"import sys
a = sys.stdin.readlines()
x = ''.join(a)
x = x.upper()
sys.stdout.write(x)"
>cat text.txt | python test.py
But I reinstalled Python 2.5 under Windows XP and i
I don't know what you did with your Python installation, but for me this
works perfectly.
test3.py contains:
import sys
print sys.stdin.readlines()
test.txt contains:
Testline1
Testline2
Output of 'python test3.py < test.txt' is:
['Testline1\n', 'Testline2']
Just plain simple and just w
Rolf van de Krol a écrit :
> According to various tutorials this should work.
>
>
> |import sys
> data = sys.stdin.readlines()
> print "Counted", len(data), "lines."|
>
>
> Please use google before asking such questions. This was found with only
> one search for the terms 'python read stdin'
>
According to various tutorials this should work.
|import sys
data = sys.stdin.readlines()
print "Counted", len(data), "lines."|
Please use google before asking such questions. This was found with only
one search for the terms 'python read stdin'
Rolf
Bernard Desnoues wrote:
> Hi,
>
> I've go
Hi,
I've got a problem with the use of Redmon (redirection port monitor). I
intend to develop a virtual printer so that I can modify data sent to
the printer.
Redmon send the data flow to the standard input and lauchs the Python
program which send modified data to the standard output (Windows X
En Mon, 24 Sep 2007 04:04:07 -0300, per9000 <[EMAIL PROTECTED]> escribi�:
> On 23 Sep, 18:24, Damjan <[EMAIL PROTECTED]> wrote:
>> > I want to create a program that reads input from stdio that can prompt
>> > a user for input while doing so without getting into problems.
>> ...
>>
>> The trick (wh
r a windows
version of the same?
/Per
--
PS: for the record:
***>cat replace3.py && echo "---" && cat input.txt | python
replace3.py
from sys import stdin, stdout
def censor(foo, bar, input):
return input.replace(foo, bar)
fp = open('/dev/tty',
> I want to create a program that reads input from stdio that can prompt
> a user for input while doing so without getting into problems.
...
> As you can see I have commented out what I'd like to do but do not
> know how to. Can I somehow halt the previous print to stdout (cat
> input.txt) - if so
hat replaces certain words
***>cat replace2.py
from sys import stdin, stdout
def censor(foo, bar, input):
return input.replace(foo, bar)
# i = raw_input('Remove what? ').strip()
# o = raw_input('Replace "%s" with what? ' %i).strip()
for line in stdin.xreadlines():
BenjaMinster schrieb:
> I want to read and write unicode on stdin and stdout. I can't seem to
> find any way to force sys.stdin.encoding and sys.stdout.encoding to be
> utf-8, so I've got the following workaround:
What operating system are you using? Why do you want to do this?
Python attempts to
I want to read and write unicode on stdin and stdout. I can't seem to
find any way to force sys.stdin.encoding and sys.stdout.encoding to be
utf-8, so I've got the following workaround:
import codecs, sys
out = codecs.getwriter("utf-8")(sys.stdout)
def tricky(): return sys.stdin.readline().decod
asdsd sir wrote:
> thank you very much for your help...
> my big mistake,was to believe that "|" is the pipe symbol for both,unix and
> python...
> it is really annoying,how such a simple thing can mess things
>
> Thank you for clearing this out.
>
It is indeed annoying when assumptions we carry
thank you very much for your help...
my big mistake,was to believe that "|" is the pipe symbol for both,unix and
python...
it is really annoying,how such a simple thing can mess things
Thank you for clearing this out.
_
Free bloggin
asdsd sir wrote:
> Hi!I'm new in Python and i'd like to ask some general questions about
> stdin,stdout...
>
> Firstly...
>
> if we type like something like :
>cat "file.txt"|python somefile.py
>
> #somefile.py
> import sys
>
Hello.
If you're new to Python, then input/output isn't the best place to
start. Begin with the tutorial:
http://docs.python.org/tut/tut.html
Other documentation is also linked to from there.
However, I will briefly answer your questions.
> print "hello"|sys.stdin.read()
In Python the | ope
Hi!I'm new in Python and i'd like to ask some general questions about
stdin,stdout...
Firstly...
if we type like something like :
cat "file.txt"|python somefile.py
#somefile.py
import sys
text=sys.stdin.read()
...then "sys.stdin.read()" will read fr
>>> And if I'm reading it correctly, the Perl
>>> script's process starts tcpdump, but redirects its output to its own
>>> input, and reads it line by line.
And to clarify, what the Perl script is doing is redirecting the standard
error to standard out. STDIN is file handle 0, STDOUT is file handl
On 2006-01-23, Grant Edwards <[EMAIL PROTECTED]> wrote:
> On 2006-01-23, Jan Danielsson <[EMAIL PROTECTED]> wrote:
>
>> And if I'm reading it correctly, the Perl
>> script's process starts tcpdump, but redirects its output to its own
>> input, and reads it line by line.
> [...]
>>...however, th
On 2006-01-23, Jan Danielsson <[EMAIL PROTECTED]> wrote:
> And if I'm reading it correctly, the Perl
> script's process starts tcpdump, but redirects its output to its own
> input, and reads it line by line.
[...]
>...however, the Perl script solution looks interresting.. Is it
> possible to d
Hello, I thought I'd write a program to collect information from pf
(packet filter) and insert it into a postgresql database for review on a
web page. First I checked if this has been done already, and found that
it has.. Using Perl and SQLite in a program called "hatchet".
Well, I want to do i
In article <[EMAIL PROTECTED]>,
Martijn Brouwer <[EMAIL PROTECTED]> wrote:
...
> I read this one, which was the reason that I tried os.close instead of
> sys.stdXXX.close(). But I would like to know why it does not close a
> file discriptor is I call its close method().
They're special. I suppos
On Mon, 2005-12-26 at 23:15 +, Robin Becker wrote:
> Robin Becker wrote:
> > Martijn Brouwer wrote:
> >
> >> I am writing a unix daemon in python, so I want to close stdin, stdout
> >> and stderr.
> >> My first attempt was to the standard file de
On Mon, 2005-12-26 at 23:13 +, Robin Becker wrote:
> Martijn Brouwer wrote:
> > I am writing a unix daemon in python, so I want to close stdin, stdout
> > and stderr.
> > My first attempt was to the standard file descriptors using their
> > close() methods. After
Robin Becker wrote:
> Martijn Brouwer wrote:
>
>> I am writing a unix daemon in python, so I want to close stdin, stdout
>> and stderr.
>> My first attempt was to the standard file descriptors using their
>> close() methods. After closing stdout, I could not print
Martijn Brouwer wrote:
> I am writing a unix daemon in python, so I want to close stdin, stdout
> and stderr.
> My first attempt was to the standard file descriptors using their
> close() methods. After closing stdout, I could not print anymore, so
> this seemed to work. However,
I am writing a unix daemon in python, so I want to close stdin, stdout
and stderr.
My first attempt was to the standard file descriptors using their
close() methods. After closing stdout, I could not print anymore, so
this seemed to work. However, later I noticed that they were not really
closed
max(01)* wrote:
> i was wondering, what's the simplest way to echo the standard input to
> the standard output, with no modification.
...
> ps: in perl you ca do this:
>
> ...
> while ($line = )
> {
> print STDOUT ("$line");
> }
> ...
I guess you could, but there wouldn't be much point.
On Fri, 19 Aug 2005 15:26:27 GMT, max(01)* <[EMAIL PROTECTED]> wrote:
> hi.
>
> i was wondering, what's the simplest way to echo the standard input to
> the standard output, with no modification.
>
> i came up with:
...
> but i guess there must be a simpler way.
>
> using bash i simply do 'cat', *
limodou wrote:
> 2005/8/19, max(01)* <[EMAIL PROTECTED]>:
>
>>hi.
>>
>>i was wondering, what's the simplest way to echo the standard input to
>>the standard output, with no modification.
>>
>>i came up with:
>>
>>...
>>while True:
>> try:
>> raw_input()
>> except EOFError:
>> break
>>.
gry@ll.mit.edu wrote:
> import sys
> for l in sys.stdin:
> sys.stdout.write(l)
This is fine if you don't need the reads and writes of lines to run in
lockstep. File iterators read into a buffer, so you'll probably read
4096 bytes from stdin before you ever write a line to stdout. If th
max(01)* wrote:
> i was wondering, what's the simplest way to echo the standard input to
> the standard output, with no modification.
import sys
for line in iter(sys.stdin.readline, ''):
sys.stdout.write(line)
Note that this uses the second form of iter(), which calls its first
argument re
import sys
for l in sys.stdin:
sys.stdout.write(l)
-- George
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 19 Aug 2005 15:26:27 GMT,
"max(01)*" <[EMAIL PROTECTED]> wrote:
> ps: in perl you ca do this:
> ...
> while ($line = )
>{
> print STDOUT ("$line");
>}
> ...
import fileinput
import sys
for line in fileinput.input():
sys.stdout.write(line)
Regards,
Dan
--
Dan Sommers
2005/8/19, max(01)* <[EMAIL PROTECTED]>:
> hi.
>
> i was wondering, what's the simplest way to echo the standard input to
> the standard output, with no modification.
>
> i came up with:
>
> ...
> while True:
>try:
> raw_input()
>except EOFError:
> break
> ...
>
> but i guess
hi.
i was wondering, what's the simplest way to echo the standard input to
the standard output, with no modification.
i came up with:
...
while True:
try:
raw_input()
except EOFError:
break
...
but i guess there must be a simpler way.
using bash i simply do 'cat', *sigh*!
bye
"common wisdom" interesting.
The value of the closed attribute is "False" when tested from within
the service.
Still digging
--
http://mail.python.org/mailman/listinfo/python-list
It seems to simply be common wisdom. e.g.,
http://mail.python.org/pipermail/python-win32/2004-September/002332.html
http://mail.mems-exchange.org/pipermail/quixote-users/2004-March/002743.html
http://twistedmatrix.com/pipermail/twisted-python/2001-December/000644.html
etc
If you can find chapter
Interesting. The stdin and stdout objects in my service seems respond
to returing a string for the statements str(sys.stdin) and
str(sys.stdout). I guess they are just not attached to files?
Can you provide a reference (MSDN or otherwise) that indicates that
Windows Services don't have standard
On Sun, Jul 17, 2005 at 06:43:00PM -0700, chuck wrote:
> I have found that sys.stdin.fileno() and sys.stdout.fileno() always
> return -1 when executed from within a win32 service written using the
> win32 extensions for Python.
>
> Anyone have experience with this or know why?
because there *is*
I have found that sys.stdin.fileno() and sys.stdout.fileno() always
return -1 when executed from within a win32 service written using the
win32 extensions for Python.
Anyone have experience with this or know why?
--
http://mail.python.org/mailman/listinfo/python-list
Michael McGarry <[EMAIL PROTECTED]> writes:
> How do I redirect stdin, stdout and stderr to a window? I am using Qt
> for GUI.
I don't know what specific mechanisms Qt provides, but the general
solution is to write a class that implements I/O methods like read,
readline, and
Hi,
How do I redirect stdin, stdout and stderr to a window? I am using Qt
for GUI.
Thanks,
Michael
--
http://mail.python.org/mailman/listinfo/python-list
Harry George <[EMAIL PROTECTED]> writes:
> Normally the SOAP Servers are designed to take control of a port and
> run their own sockets via inheritance from SocktServer.
>
> But under inetd and xinetd, the port is controlled elsewhere and the
> service just gets the st
gt; service just gets the stdin/stdout. I need to configure (or tweak) one
> of the SOAP servers to use that connection.
>
> Has anyone done this with any of the above named SOAP servers?
> Recommmendations or hints if I try it myself?
>
Twisted can run any protoco
Normally the SOAP Servers are designed to take control of a port and
run their own sockets via inheritance from SocktServer.
But under inetd and xinetd, the port is controlled elsewhere and the
service just gets the stdin/stdout. I need to configure (or tweak) one
of the SOAP servers to use that
78 matches
Mail list logo