Comments (2)
When the device disappears and reapers while the port is open, it won't work under the old name. Other operating systems tend to assign a new device in such cases, e.g. under Linux, it may become /dv/ttyUSB1 and /dev/ttyUSB0 will disappear as soon as the application closes the port. Windows tries to assign the same COM port for the device so the old instance shadows the new one, or something like that.
I know of no workaround. Maybe there are solutions, e.g. if the device is connected through a hub, the hub could be disabled or the device itself could be powered down. USB has such commands but i do not know of a Windows API that exposes these (never looked for that).
Alternatively, make your device slower so that the PC can close the port before the device reappears on USB... like an additional delay at startup (maybe only when the device is in test mode).
A silly alternative would be to use two (or more?) alternating serial numbers for the device, so it would get a different COM port after each reboot of the device. But i would not suggest to really do this.
from pyserial.
Hope it helps someone to come up with a solution: this problem has a workaround for C# http://stackoverflow.com/a/9057158/396583 And it works reliably. Port gets reopened alright after replugging USB cable.
from pyserial.
Related Issues (20)
- Import of imp breaks with Python 3.12 HOT 3
- multiple opening
- Update stable version in repo
- Windows fatal exception: stack overflow on serial.Serial with JLink CDC
- No possible way to set dtr and rts state during method open. HOT 4
- self.readline() not respecting self.timeout
- DTR and RST set at different times
- Loopback in less than 1ms HOT 1
- PySerial only working from interactive python, not from script in windows HOT 2
- pyserial stuck HOT 2
- TX stops after a few bytes - unless port is being read elsewhere HOT 3
- USB CDC/ACM: hangs on non implemented optional class-specific request codes in Win10 HOT 2
- Python 12 on windows no module named imp
- PySerial removing/adding bytes randomly
- Write method cause gap between bytes on Mac os HOT 1
- Request: tag the v3.5 release that's on pip but not on GitHub HOT 1
- Sometimes this exception is reported when calling open
- Certificate problem with installation
- Failed to parse location: ERROR_INSUFFICIENT_BUFFER
- May I ask if pyserial supports Python 2.6.6 32bit?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyserial.