Python Forum
Thread Rating:
  • 2 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need help with pySerial
#1
I'm trying to write a program that reads from a serial port and writes to a file. But I can't make pySerial work.

"import serial" at the start of the program triggers no errors despite the fact that the file serial.py is not in the directory. Shouldn't it?

Line two of the introduction (can't post link, sorry) however triggers an error:

>>> import serial
>>> ser = serial.Serial('/dev/ttyUSB0')  # open serial port
Error:
Traceback (most recent call last):   File "<stdin>", line 1, in <module>   File "C:\Users\steen\AppData\Local\Programs\Python\Python36-32\lib\site-packag es\serial\serialwin32.py", line 31, in __init__     super(Serial, self).__init__(*args, **kwargs)   File "C:\Users\steen\AppData\Local\Programs\Python\Python36-32\lib\site-packag es\serial\serialutil.py", line 240, in __init__     self.open()   File "C:\Users\steen\AppData\Local\Programs\Python\Python36-32\lib\site-packag es\serial\serialwin32.py", line 62, in open     raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError())) serial.serialutil.SerialException: could not open port '/dev/ttyUSB0': FileNotFo undError(2, 'Den angivne sti blev ikke fundet.', None, 3) >>>
If I can't even make the introduction work, I don't know what to do. Any help would be greatly appreciated :-)

Moderator Larz60+: Added error tags.
Reply


Messages In This Thread
I need help with pySerial - by oz1sej - Apr-12-2017, 05:56 AM
RE: I need help with pySerial - by j.crater - Apr-12-2017, 06:12 AM
RE: I need help with pySerial - by buran - Apr-12-2017, 06:13 AM
RE: I need help with pySerial - by oz1sej - Apr-12-2017, 07:14 AM
RE: I need help with pySerial - by j.crater - Apr-12-2017, 07:21 AM
RE: I need help with pySerial - by oz1sej - Apr-12-2017, 07:41 AM
RE: I need help with pySerial - by j.crater - Apr-12-2017, 07:45 AM
RE: I need help with pySerial - by oz1sej - Apr-12-2017, 09:53 AM
RE: I need help with pySerial - by j.crater - Apr-13-2017, 05:20 AM
RE: I need help with pySerial - by Larz60+ - Apr-13-2017, 06:12 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020