Re: DJango, threads and serial port

2009-03-31 Thread Filip Gruszczyński
> So, sys.path becomes None somewhere before you create the Serial object > in another thread? I'm afraid your options are either 1. add watchpoints > to pdb (http://wiki.python.org/moin/PdbImprovments), or 2. use binary > search principle to insert printfs into the middle of the execution > noodl

Re: DJango, threads and serial port

2009-03-31 Thread Baurzhan Ismagulov
On Tue, Mar 31, 2009 at 11:32:58AM +0200, Filip Gruszczyński wrote: > The problem is not reproducible with one thread. If I open the serial > port on the main thread and then operate on this on additional > threads, everything works fine. So, sys.path becomes None somewhere before you create the

Re: DJango, threads and serial port

2009-03-31 Thread Filip Gruszczyński
>> If the problem is reproducible with one thread, I'd use it for >> debugging. > I will try to debug without threads and see what happens. The problem is not reproducible with one thread. If I open the serial port on the main thread and then operate on this on additional threads, everything wo

Re: DJango, threads and serial port

2009-03-26 Thread Filip Gruszczyński
> If the problem is reproducible with one thread, I'd use it for > debugging. > > Although I've never thought about using threads from Django; what will > your "main" thread answer to the browser? Main thread is not dependant of the other threads it calls. It just tells them to do something and t

Re: DJango, threads and serial port

2009-03-26 Thread Baurzhan Ismagulov
On Thu, Mar 26, 2009 at 05:45:49PM +0100, Filip Gruszczyński wrote: > I tried using import pdb right before the exception and runing > set_trace, but it just displayed next command and finished. This code > is executed in separate thread (ususally operations on serial port > take a while, so I hav

Re: DJango, threads and serial port

2009-03-26 Thread Baurzhan Ismagulov
On Thu, Mar 26, 2009 at 05:15:32PM +0100, Filip Gruszczyński wrote: > I don't exactly know, how to achieve this. Our server is run through a > bash script with runfcgi command. Should I put somwhere pdb import and > try to start inside the code? AFAIK, you should be able to debug your scripts if

Re: DJango, threads and serial port

2009-03-26 Thread Filip Gruszczyński
I tried using import pdb right before the exception and runing set_trace, but it just displayed next command and finished. This code is executed in separate thread (ususally operations on serial port take a while, so I have to do it on seperate thread). 2009/3/26 Filip Gruszczyński : >> Hmm, sys.

Re: DJango, threads and serial port

2009-03-26 Thread Filip Gruszczyński
> Hmm, sys.path is None? I'd use a debugger to see the difference between > the working and not working case. I don't exactly know, how to achieve this. Our server is run through a bash script with runfcgi command. Should I put somwhere pdb import and try to start inside the code? Strangely, whe

Re: DJango, threads and serial port

2009-03-26 Thread Baurzhan Ismagulov
Hello Filip, On Thu, Mar 26, 2009 at 04:35:19PM +0100, Filip Gruszczyński wrote: > If I just import my sms module, everything works fine. ... > But when I add to DJango, the initialisation fails. ... > for dirname in sys.path: > TypeError: 'NoneType' object is not iterable Hmm, sys.path is N

DJango, threads and serial port

2009-03-26 Thread Filip Gruszczyński
I am trying to use connection to a serial device in my DJango app. It's a GSM modem I want to use to send sms's. If I just import my sms module, everything works fine. Module connects to modem, sets it to text format and then just allows me to send some sms's. But when I add to DJango, the initi