-->
Page 1 of 1

Getting frustrated : Serial Object has no attribute dtr

PostPosted: Thu Jul 23, 2020 3:56 pm
by bdepauw
pffff....

I managed already to have Python working on my Windows 7 PC ( I know old and should update to WIN10 ... )
Want to do a backup from current firmware to .bin for my newly never used SONOFF S20
( firmware seems to be not general available and locked per device, so I need backup from this one )

When starting command :
python esptool.py -b 115200 --port COM6 read_flash 0x000000 0x100000 flash_1M.bin
It won't readout and gives error :
AttributeError: 'Serial' Object has no attribute 'dtr'

I'm using a CH340 ESP-01 usb to serial TTL module, and my connections seems correct as I can read out via Putty @ speed 74880 :

ets Jan 8 2013,rst cause:1, boot mode:(3,6)

load 0x40100000, len 2408, room 16
tail 8
chksum 0xe5
load 0x3ffe8000, len 776, room 0
tail 8
chksum 0x84
load 0x3ffe8310, len 632, room 0
tail 8
chksum 0xd8
csum 0xd8

2nd boot version : 1.6
SPI Speed : 40MHz
SPI Mode : DOUT
SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 @ 1000

rf cal sector: 251
rf[112]


Someone an alternative solution to backup firmware ? (without esptool ? )
Or a solution for the 'dtr' problem ?

Thanks for any reaction/reply !

Re: Getting frustrated : Serial Object has no attribute dtr

PostPosted: Fri Jul 24, 2020 3:49 am
by bdepauw
Found it myself.
It was as simple as commenting out the error line 436 in esptool.py to
# self._port.setDTR(self._port.dtr)

Re: Getting frustrated : Serial Object has no attribute dtr

PostPosted: Thu Feb 11, 2021 10:32 pm
by psilospiral
I want to thank you for posting this along with your solution. Commenting out the line
Code: Select all#      self._port.setDTR(self._port.dtr)

did the trick for solving my compile time error on Debian:
Code: Select allAttributeError: 'Serial' object has no attribute 'dtr'

Much appreciated!

Re: Getting frustrated : Serial Object has no attribute dtr

PostPosted: Sat Feb 13, 2021 8:07 pm
by psilospiral
For those interested, I was also able to solve this dtr error by upgrading my pyserial from 2.7 to 3.5, even though I am running python 2.7.16. I removed the # from
Code: Select all#      self._port.setDTR(self._port.dtr)

upgraded pyserial, and was able to compile in Arduino without the dtr error!