[BangPypers] Python script hangs after using logging module

Rahul Gopan rahulpcet19 at gmail.com
Mon May 26 14:12:47 CEST 2014



-----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()

Regards,
Rahul


More information about the BangPypers mailing list