[BangPypers] Python script hangs after using logging module

Gora Mohanty gora at mimirtech.com
Mon May 26 14:34:59 CEST 2014

On 26 May 2014 17:42, Rahul Gopan <rahulpcet19 at gmail.com> wrote:
> -----Original Message-----
> From: "Rahul G" <rahul at visolve.com>
> Sent: ‎26-‎05-‎2014 05:41 PM
> To: "rahulpcet19 at gmail.com" <rahulpcet19 at gmail.com>
> Subject: Python script hangs after using logging module
> Hello,
> I tried to make a log file in a python script. After adding the line below
> logging.basicConfig(filename='LOG_FILE.log',
>                     filemode='w',
>                     format='%(asctime)s %(message)s',
>                     level=logging.DEBUG)
> Now when I try to run a binary file using os.system or commands.getoutput, script simply hangs. Binary file is supposed to provide me the number of items available within two numbers in a particular branch
> Usage of that command : range <branch> <Begin_number> <End_number>
> Without using the above logging line, I could run this command.
> I used trace python -m trace --trace myscript.sh to see where exactly it hangs.Last few lines from the output of trace work of python is
> commands.py(58): import os
> commands.py(59): pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r')
> commands.py(60): text = pipe.read()

I see no reason from the above that a logging statement like the above
would cause the script to hang. Please show us your complete script.
If it is tool long, use pastebin.com, and post the link here.


More information about the BangPypers mailing list