spenceraxani / CosmicWatch-Desktop-Muon-Detector-v2

The CosmicWatch Desktop Muon Detector supplementary material
236 stars 70 forks source link

Cannot run detector_server.py or import_data_py3.py #107

Open fbarradas opened 11 months ago

fbarradas commented 11 months ago

This is what happens if I try to run detector_server.py (from Spyder from MacOS 13.4.1):

Screenshot 2023-07-20 at 02 37 57

and if I try tro run import_data_py3.py:

Screenshot 2023-07-20 at 02 40 54
fbarradas commented 11 months ago

And this is the same working from the Linux terminal image

spenceraxani commented 11 months ago

Hi,

Where did the detector_server.py code come from? In the Arduino folder there is only import_data.py.

It looks like the first error is just that the code has spaces instead of indents, and your text editor cares about that. You would have to change the spaces into tabs, or tabs into spaces.

The second error relating to threads. I cannot test it at the moment. But I see that we are importing something called _thread, whereas the text uses something called thread. My guess is that you should be able to change thread->_thread and it will work.

Best,

Spencer

─ Dr. Spencer N. Axani @. @.>

Assistant Professor The University of Delaware 203 Sharp Lab 104 The Green, Newark, DE 19716 (608) 572-8426

On Jul 20, 2023, at 7:21 AM, fbarradas @.***> wrote:

And this is the same working from the Linux terminal https://user-images.githubusercontent.com/49408729/254867638-ce3a888e-7957-4d4d-a13b-8a0104591d51.png — Reply to this email directly, view it on GitHub https://github.com/spenceraxani/CosmicWatch-Desktop-Muon-Detector-v2/issues/107#issuecomment-1643743399, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANF5O53P2ZT7JAOOL7LCXLXREIB3ANCNFSM6AAAAAA2QVKNGQ. You are receiving this because you are subscribed to this thread.

anthfuller commented 11 months ago

I'm also seeing this error code, running "import_data_py3.py" as well. When running the script directly for Ubuntu 22.04 terminal, cd down into CosmicWatchDesktop-Muon detector cloned folder. After executing the script, there are five choices, the last being [h] for help. When selecting option "1", Record data on computer, the script prompts for a USB Port number, entering the number, I get this error: Traceback (most recent call last): File "/home/radiomuon/muon/CosmicWatch-Desktop-Muon-Detector-v2/Recording_Data/import_data_py3.py", line 195, in port_name_list.append(str(port_list[int(ArduinoPort[i])-1])) IndexError: list index out of range

Can you help with this, looks like an issue with the script on line 195? Screenshot from 2023-07-26 19-44-52

I'm noticing no USB ports are shown in the terminal indicating the port the Muon detector is connected to. I've done a lsusb list and this is what's shown: Screenshot from 2023-07-26 19-42-52

spenceraxani commented 11 months ago

Hi,

Would you be able to post a screen shot? Does your computer see the Arduino? As in, were you able to upload the code to the Arduino through the Arduino IDE?

Thanks,

Spencer

─ Dr. Spencer N. Axani @. @.>

Assistant Professor The University of Delaware 203 Sharp Lab 104 The Green, Newark, DE 19716 (608) 572-8426

On Jul 26, 2023, at 5:30 PM, anthony.fuller @.***> wrote:

I'm also seeing this error code, running "import_data_py3.py" as well. When running the script, there are five choices, the last being [h] for help. When selecting option "1", Record data on computer, the script prompts for a USB Port number, entering the number, I get this error: Traceback (most recent call last): File "/home/radiomuon/muon/CosmicWatch-Desktop-Muon-Detector-v2/Recording_Data/import_data_py3.py", line 195, in port_name_list.append(str(port_list[int(ArduinoPort[i])-1])) IndexError: list index out of range

Can you help with this, looks like an issue with the script on line 195?

— Reply to this email directly, view it on GitHub https://github.com/spenceraxani/CosmicWatch-Desktop-Muon-Detector-v2/issues/107#issuecomment-1652680620, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANF5O4FTWMQL4UCGDDGM53XSGSADANCNFSM6AAAAAA2QVKNGQ. You are receiving this because you commented.

JG-QuarkNet commented 1 week ago

@anthfuller Your "IndexError: list index out of range" error is different from the previous errors in this thead and likely has a separate solution. Fortunately I had the exact same problem, which I traced to this issue: https://github.com/arduino/help-center-content/issues/155

The Linux BRLTTY utility for braille displays is sometimes enabled by default, and has been in particular for recent versions of Ubuntu. Unfortunately, BRLTTY is programmed to take over serial ports automatically, which interferes with the import_data_py3.py script's scan of your ports.

You can confirm whether or not this is your problem by checking dmesg output related to tty and looking for a line that cites 'brltty' like the following:

$ sudo dmesg | grep tty 
[ 5339.669621] usb 3-4: usbfs: interface 0 claimed by ftdi_sio while 'brltty' sets config #1

If you don't need the brltty utility, the easiest solution is to uninstall it with $ sudo apt remove brltty (for Debian/Ubuntu, adapt for your distribution as necessary).

If you do need the brltty utility, you'll have to find another way to make it let go of the ports. There's more info on that Arduino GitHub issue I posted above.