"Paul" <nos...@needed.com> wrote in message news:jseu9c$sp3$1...@dont-email.me... > Adam wrote: >> "John Nagle" <na...@animats.com> wrote in message >> news:jse604$1cq$1...@dont-email.me... >>> 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
Thanks (Guru Paul), I've been using the USB-to-serial converter successfully without enabling/remapping via VBox Settings=>Serial Ports (which are both "not" enabled). I can see the serial port COM4 under Device Manager though. So, maybe enabling is necessary when the host has "native" serial ports, which my laptop does not have. >From the output generated by Handle.exe, here's the section for TeraTerm ... ------------------------------------------------------------------------------ ttermpro.exe pid: 596 VBOX_WINXPPRO\adam (claims to use COM4) C: File (RW-) D:\downloads\Tera Term Pro\ttpro313 2C: Section \BaseNamedObjects\ttset_memfilemap 44: File (RW-) C:\WINDOWS.0\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.6028_x-ww_61e65202 54: File (RW-) C:\WINDOWS.0\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.6195_x-ww_44262b86 70: Section \BaseNamedObjects\_ISWINTERNAL_EPT32_SHEX_K32_0_1c9aa25ea688500_7c80_S-1-5-21-1801674531-1078145449-1957994488-1004 78: File (RWD) C:\DOCUME~1\adam\LOCALS~1\Temp\IswTmp\Logs\ISWSHEX.swl AC: Section \BaseNamedObjects\_ISWINTERNAL_EPT32_SHEX_A32_0_1c98aa70f70ec00_77dd_S-1-5-21-1801674531-1078145449-1957994488-1004 100: Section \BaseNamedObjects\CiceroSharedMemDefaultS-1-5-21-1801674531-1078145449-1957994488-1004 108: File (RW-) D:\downloads\Tera Term Pro\ttpro313\httplog.log 120: Section \BaseNamedObjects\CTF.TimListCache.FMPDefaultS-1-5-21-1801674531-1078145449-1957994488-1004SFM.DefaultS-1-5-21-1801674531-1078145449-1957994488-1004 128: Section \BaseNamedObjects\ShimSharedMemory 138: Section \BaseNamedObjects\MSCTF.Shared.SFM.IAB ------------------------------------------------------------------------------ -- http://mail.python.org/mailman/listinfo/python-list