Adam wrote:
On 6/26/2012 9:12 PM, Adam wrote:
Host OS: Ubuntu 10.04 LTS
Guest OS: Windows XP Pro SP3
I am able to open port COM4 with Terminal emulator.
So, what can cause PySerial to generate the following error ...
C:\Wattcher>python wattcher.py
Traceback (most recent call last):
File "wattcher.py", line 56, in <module>
ser.open()
File "C:\Python25\Lib\site-packages\serial\serialwin32.py", line
56, in
open
raise SerialException("could not open port %s: %s" %
(self.portstr,
ctypes.WinError()))
serial.serialutil.SerialException: could not open port COM4: [Error
5]
Access is denied.
Are you trying to access serial ports from a virtual machine?
Which virtual machine environment? Xen? VMware? QEmu? VirtualBox?
I wouldn't expect that to work in most of those.
What is "COM4", anyway? Few machines today actually have four
serial ports. Is some device emulating a serial port?
John Nagle
Thanks, and yes, I am using VirtualBox. My laptop does not have a
serial port so
I use a USB-to-serial converter, which is assigned COM4.
Doesn't VirtualBox allow "remapping" serial ports ? I thought you
could have COM 4 in the host OS, and make it COM 1 or COM 2 in
the guest. Something like that.
http://virtuatopia.com/images/6/60/Virtualbox_serial_port_settings.jpg
Also, Windows (as a host), is notorious for stealing control of
COM ports. Even Windows software, when you run it, would report
"COM 4 is busy". Then, you have to track down *why* it's busy.
Is it that FAX software you installed ? The GPS software
that talks to your GPS serial interface ?
In theory, the "Handle" program is supposed to identify what
is keeping a COM port busy, but I don't get the desired
results from it very often. You need to know the naming
convention for virtual COM ports (COM4 via USB to serial, is
more virtual than physical). That's what makes it harder
to track down.
These are some names for COM ports, in Windows. The last two entries,
are my USB to serial adapters. VCP1 functions as COM3.
VCP0 functions as COM4. The VCP part is what would be
listed in "Handle" from Sysinternals. The \device\serial
format, is more likely to be used with true "native"
motherboard serial ports.
\device\serial
ups.exe pid: 1072 NT AUTHORITY\SYSTEM
98: File (---) \Device\VCP0
hypertrm.exe pid: 3404 ComputerName\UserID (claims to use COM3)
E0: File (---) \Device\VCP1
You can download "Handle" and play with it here.
http://technet.microsoft.com/en-us/sysinternals/bb896655
Note that, in my Handle results, at the time I was running
the Windows provided ups.exe to talk to my external UPS
(uninterruptible power supply). So that's what that
reference is. The "hypertrm" one, is me using the
built-in Windows terminal software, to talk to COM3,
to keep the port artificially busy for the purposes
of testing.
If things were working well in your case, you *might*
see something of this form. If not, you'd instead
see the name of the process that has "stolen" the
com port.
virtualbox.exe pid: 1234 ComputerName\UserID
E0: File (---) \Device\VCP0
HTH,
Paul