Serial in python: how to avoid reset on opening

Hi all,
I’m developing an application on Duemilanove that should offer serial comunication (though USB cable).
I would like to avoid arduino resetting itself each time a serial connection is established.

I do not want to modify Arduino as suggested here http://www.arduino.cc/en/Main/ArduinoBoardDuemilanove

I should be able to manage DTR (to avoid the reset) in my Python application. According to specs, DTR causes the reset if pulled low.

I do not want to modify the serial python library as suggested here http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1274205532/5

Here is my python code. I’m trying to set DTR high to disable reset.
Unfortunately it does not work.

import time
import serial

configure the serial connections (the parameters differs on the device you are connecting to)

ser = serial.Serial(
port=’/dev/ttyUSB0’,
baudrate=9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
dsrdtr=False,
rtscts=False,
timeout=1
)

ser.setDTR(True)

ser.open()
ser.isOpen()

send GP* string (custom command for my application)

ser.write(‘GP*’)
out = ‘’
time.sleep(1)
while ser.inWaiting() > 0:
out += ser.read(1)
if out != ‘’:
print “>>” + out

Any suggestions?

Its pretty easy to do a hardware disable of the auto-reset without modifying the arduino - stick a 1uF -10uF capacitor between gnd & reset. It doesn’t matter what your software is doing then.

Thanks pluggy. Your suggestion works fine, but as far as I understand, the capacitor need to be removed in order to upload a new program to Arduino. Is it correct?
I can be done easily using a switch to insert/remove the capacitor…

You don't have to remove it, you can use the pressing reset at the right time method, its something of an acquired skill and its probably easier to remove the capacitor.......

Depending on the wiring you could just plug the capacitor leads into the sockets on the arduino and pull one out when programming it.

Thanks pluggy, once again.

I had a look to your website, and I was surprised that we are working on a similar project. I'm also developing an "home data logger" with Arduino. I'm reading photovoltaic energy production through the energy meter led blinking.
Here is my project description (in italian, sorry)
http://www.viadellaluna2.it/cuoredilegno/?page_id=1661