[issue9503] print statement hangs Windows service

2010-09-09 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Closing as a duplicate of issue706263.

Instead of changing all print statements, you could set sys.stdout to another 
file, for example:
sys.stdout=StringIO()
or another object that simply discards written data.

--
nosy: +amaury.forgeotdarc
resolution:  -> duplicate
status: open -> closed
superseder:  -> print raises exception when no console available

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9503] print statement hangs Windows service

2010-08-10 Thread Florent Xicluna

Changes by Florent Xicluna :


--
components: +Windows

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9503] print statement hangs Windows service

2010-08-04 Thread rgpitts

rgpitts  added the comment:

I've created a test service that demostrates the problem. The example service 
calls PyRun_SimpleString in loop that evaluates the Python statement "print 
'String'". The number of iteration in the loop depends on the length of the 
string used in the print statement. The longer the string the fewer iteration.

Attached is a Visual Studio 2008 project and readme.

--
Added file: http://bugs.python.org/file18373/PythonService.zip

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9503] print statement hangs Windows service

2010-08-04 Thread Eric Smith

Changes by Eric Smith :


--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9503] print statement hangs Windows service

2010-08-04 Thread Tim Golden

Changes by Tim Golden :


--
nosy: +tim.golden

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9503] print statement hangs Windows service

2010-08-04 Thread rgpitts

New submission from rgpitts :

OS: Windows 2003 Server R2 x64 Standard Edition
Python: 2.6.5
MSVC: 9.0
Application Description: Windows service calling Python C API to run algorithm 
written in Python.

I've been encountering a random application hang when calling the Python C API 
function PyObject_CallMethod to call a function on a class instance. I've 
discovered that the C function fwrite in string_print in stringobject.c is 
blocking after being called multiple times due to print statements in Python 
code. My application as a Windows service does not have a stdout and fwrite is 
buffering data before attempting to write it to a non-existent stdout, thus 
blocking and hanging the service. This isn't an issue when the application has 
a console window because stdout is available.

We are in the process changing the print statements to write to file. Ideally a 
Python exception needs raising if print cannot write to stdout.

--
components: Interpreter Core
messages: 112768
nosy: rgpitts
priority: normal
severity: normal
status: open
title: print statement hangs Windows service
type: behavior
versions: Python 2.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com