For weeks I've been using the same code without any problems.
I call SIGNAL within a thread and it's working like a charm.

Then I bring the same module home to the same environment (Ubuntu Jaunty, Python 2.6) and now I'm getting this error: ValueError: signal only works in main thread

After encountering this error, I researched the cause and found that you can't have a signal outside of the main thread. But that's precisely what I've been doing all month.

The code works like this:

In wxpython, I have a progressbar.

I call a thread to test if I have VPN connectivity to a site before starting the main program. During this test, I update the progressbar.

I use a signal so that if doOne() in the ping.py module gets hung up, it'll time out. Even with a timeout in doOne(), I've seen the module hang so I added a signal to ping.py.

My question is not what causes the valueerror, but how is it possible for it to work on one computer but not another? I installed the OS and all modules and maintain both boxes.

I know how to resolve the problem by adding a signal prior to calling the thread but that still leaves me baffled and I hate loose strings.

I took my ping.py from ftp://ftp.visi.com/users/mdc/ping.py. It seems that doOne accepts a timeout argument. Why don't you use it ?

I'm using the identical ping.py module that you referenced above.

As I said in my original post, I do use a timeout parameter, but as I previously said, I've seen doOne() HANG which is why I added a signal.

"I use a signal so that if doOne() in the ping.py module gets hung up, it'll time out. Even with a timeout in doOne(), I've seen the module hang so I added a signal to ping.py."

Whether or not signal is necessary isn't the point. The original question is how can the same exact module work on one computer but not another that's built the same?

My level of confidence that my python/wxpython code will work properly on other Ubuntu boxes has been greatly lowered.

Edited 7 Years Ago by JustAnotherJoe: n/a

Wow. I wish I could erase my entire moronic thread.

Long story short. The code at work was the same as home.

Somehow the modified code with the signal handler was overwritten at work and I didn't notice until I returned to the office location.

I ASSumed. Mea culpa.

This question has already been answered. Start a new discussion instead.