We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
port in use exception (Read 9186 times)
port in use exception
May 5th, 2005, 3:38am
 
I have a parallax stamp, the USB kind (it requires a driver, which I've downloaded, I have run simple PBasic routines on it). I'm on OSX using MacBS2 for the PBasic part...

I followed the first Serial example, and initialized my Serial object with :

new Serial(this, Serial.list()[2], 9200);

I changed the list() index to 2 because my Serial list gives me this:

/dev/tty.modem
/dev/cu.modem
/dev/tty.usbserial-191
/dev/cu.usbserial-191

Although I've since tried everything in that list... no matter what, I get:

gnu.io.PortInUseException: Unknown Application

If I omit the port name in the constructor it initializes ok, but crashes when I try to write to it...

Any thoughts?

Thanks
Re: port in use exception
Reply #1 - May 5th, 2005, 4:01pm
 
make sure you're not running the stamp application. also make sure you don't have any sort of palmos sync software that might be running in the background and holding up the ports.

also try opening a program like zterm to read from the serial port and make sure that things are working (but quit before trying with processing again).
Re: port in use exception
Reply #2 - May 6th, 2005, 2:57am
 
Thanks -
I've tried shutting down everything except Processing.
I've tried restarting and only opening Processing.
I have also tried a friends serial stamp (with a usb to serial adaptor).
I still get stuck on that exception.

I've been looking through my running processes to see if there's anything there, I don't know how to tell what could be occupying the port.

The stamp app - MacBS2 - can talk to the stamp without issues. I've loaded scripts to the stamp.

Zterm doesn't appear to tell me what application is using the port.

Any other thoughts?
Re: port in use exception
Reply #3 - May 6th, 2005, 3:22am
 
you've read the faq, right?
http://processing.org/faq/bugs.html#serial
Re: port in use exception
Reply #4 - May 6th, 2005, 4:01am
 
UGH! my bad...
Thanks for your help
Re: port in use exception
Reply #5 - May 18th, 2005, 12:02am
 
FWIW, the port in use exception comes up again (in v.0090) when you install OSX 10.4 (tiger) because the installer wipes out your permissions and groups on /var/spool/uucp.  

Once you run the macosx setup command, you get:

check_group_uucp(): error testing lock file                  creation Error details: Permission deniedcheck_lock_status: No permission to create lock file.

I don't have an answer for it yet, but I'm working on it.
Re: port in use exception
Reply #6 - May 18th, 2005, 12:37am
 
Okay, I solved the tiger problem. Here is the extremely technical solution:

After you have run the macosx_setup.command,

Shut down the machine and restart.

Don't logout then log back in.  Don't just restart.  Shut down and restart.  I don't care that you've got a record uptime you're trying to preserve. SHUT DOWN AND RESTART! Don't be an idiot like I was.  This will free up the old lock files, which apparently carry over from the previous systems, and your serial devices will be happy.

And on that note, Tiger and Processing are playing happily together with a serial port, like kittens with a ball of string.



Re: port in use exception
Reply #7 - May 19th, 2005, 6:51pm
 
thanks tom, added this to the faq.
Re: port in use exception
Reply #8 - May 27th, 2005, 1:11am
 
I ran into a similar problem using the serial version of the basic stamp II carier board in conjunction with the keyspan 4-port USB->serial adapter. No matter what I tried, I got the port in use exception.

It turns out that there's a known issue with trying to communicate with the stamp over its dedicated serial port, i.e., the one used to program it. The resolution to the problem is to splice a 0.1uF cap into the DTR line (pin 4).

You can find the details here:

http://www.parallax.com/html_pages/tech/faqs/fctl_info.asp#How_does_the_ATN_pin_work
Re: port in use exception
Reply #9 - Dec 6th, 2005, 1:25pm
 
I have a Wiring board, attached to a mac system 10.4.3.  All communication with the Wiring board works fine (not a single error).  The serial monitor in Wiring reads the output of the ioboard fine.

However when I try reading the Wiring board output in Processing (97), I ran into some problems. Processing outputs this:
----------------------
Devel Library
=========================================
Native lib Version = RXTX-2.1-7pre17
Java lib Version   = RXTX-2.1-7pre17
/dev/tty.modem
/dev/cu.modem
/dev/tty.usbserial-5B233
/dev/cu.usbserial-5B233
/dev/tty.modem
/dev/cu.modem
/dev/tty.usbserial-5B233
/dev/cu.usbserial-5B233

RXTX uucp_lock() /var/spool/uucp/LK.001.009.003 is there
gnu.io.PortInUseException: Unknown Application

-------------------
I tried some solutions posted here:
- quitting all applications other than processing
- running macosx_setup.command and then shutting down the computer completely and restarting.
Same thing.

In addition I checked the /var/spool/uucp/ folder in the Terminal.  I found it odd not to find the /var/spool/uucp/LK.001.009.003 file in there (the error said it was).  I completely deleted the /var/spool/uucp folder and re-ran macosx_setup.command again.  No go.

Are there more things I can try?
I couldn't figure out ZTerm - but since Wiring can talk to the port, why shouldn't it work in Processing?
Re: port in use exception
Reply #10 - Apr 30th, 2006, 8:16pm
 
I am using mac os x 10.4.6, just installed wiring 006 and processing 0114.
I ran into the same problems, which I did not have with wiring 005 and processing 0098.

I ran the macosx_setup.command. After that wiring's serial monitor showed me good results.
After starting processing and i did not get any errors in porcessing but now I get the same error message in wiring as you guys.
(Error inside Serial.<init>()
gnu.io.PortInUseException: Unknown Application )

restarting, macosx_setup.command and all things suggested in the processing discourse do not help in my case.
Re: port in use exception
Reply #11 - May 3rd, 2006, 5:15pm
 
i could not fix the problem yet. but to i will still shared my findings:

i used a totally new computer with mac os x 10.4.6

installed usbserialdriver

copied processing 0114
copied wiring 006

ran macosx_setup.comman from WIRING folder and rebooted

wiring's serial monitor gives me good readings
processing gives with an error message
'gnu.io.portInUseException: Unknown Application'

wiring's serial monitor gives me still good readings

no files in lock folder yet
no files in spool/uucp folder yet

ran macosx_setup.comman from PROCESSING folder and rebooted

after running processing twice (I changed the print(); to println() for better readings)
i get the RXTX warning : removing stale lock file . var/lock/ ......

and i get the same numbers printer out 57,50,57,51,57,52 which has nothing to do with the numbers send from the i/o wiring board

the spool/uucp folder is still empty

running wiring now the serial monitor give an error message
"inside serial.<int>()
gnu.io.portuseexception: unknown application"

now i deleted the files out of spool/uucp and the wiring serial monitor is giving me good readings

but processing still does not receive the information send by the i/o board


my guess is that when processing starts it some how blocks the serial port, because afterwards wiring is not able to access the serial port without cleaning up the spool and lock folder.
And processing only receives strange numbers.

alright I have to do something more that lifts up my mood.
bye
Re: port in use exception
Reply #12 - May 3rd, 2006, 5:34pm
 
Is processing set to recieve serial at the same rate that it is being sent - if you are recieving something but it looks like garbage that can be the problem sometimes.

HTH

Cheers

Nick
Re: port in use exception
Reply #13 - Mar 26th, 2007, 10:51pm
 
So is there a standard resolution to this issue? I have just gotten an Arduino board, use Arduino 007 - for which there is no mac setup command anymore. I'm using the latest Processing with the Serial library and get port in use exception or Serial.write errors....
Page Index Toggle Pages: 1