|
Post by Dylan MSGC on Apr 21, 2016 19:39:51 GMT -7
This issue arose in email conversations
"I am in the process of installing all of the python packages onto a new computer. I am getting the error
Traceback (most recent call last): File "C:\Users\Flaten Lab User\Desktop\Eclipse\RFDpython\RFD900_PC_V7_branch.py", line 24, in <module> import ImageTk ImportError: No module named ImageTk
I have done some research and I believe I need PIL. I have installed pillow, but I continue to get this error. I looked for PIL and I found an installer from 2009, but when I run it says Python 2.7 is require and it isn't found in the registry."
-Emailed Question
"PIL can be installed using pip install. Also double check that if you do use pip install that it is updated to the newest version. Pillow-PIL should be capable of running ImageTk.
Also, if you have python 2.7 on your computer in addition to anaconda, you will have to make sure that when you install PIL or Pillow-PIL that it installs to the right site-packages folder. We are working on making this install process easier."
- My response
Solution found to be installing Pillow-PIL instead of Pillow.
|
|
|
Post by Iadevaia on Sept 28, 2016 17:36:01 GMT -7
Here's what I get when I run RFD_900PC.py: Python 2.7.12 |Anaconda 4.1.1 (64-bit)| (default, Jun 29 2016, 11:07:13) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. Anaconda is brought to you by Continuum Analytics. Please check out: continuum.io/thanks and anaconda.org>>> runfile('C:/Users/David/Desktop/RFDEclipseRadio/July Workshop Ground Station Software (RFD and Tracking)/July Workshop Ground Station Software (RFD and Tracking)/RFD_Ground_Station/RFD900_PC.py', wdir='C:/Users/David/Desktop/RFDEclipseRadio/July Workshop Ground Station Software (RFD and Tracking)/July Workshop Ground Station Software (RFD and Tracking)/RFD_Ground_Station') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\David\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 714, in runfile execfile(filename, namespace) File "C:\Users\David\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 74, in execfile exec(compile(scripttext, filename, 'exec'), glob, loc) File "C:/Users/David/Desktop/RFDEclipseRadio/July Workshop Ground Station Software (RFD and Tracking)/July Workshop Ground Station Software (RFD and Tracking)/RFD_Ground_Station/RFD900_PC.py", line 704, in <module> photo = ImageTk.PhotoImage(reim) File "C:\Users\David\Anaconda2\lib\site-packages\PIL\ImageTk.py", line 115, in __init__ self.paste(image) File "C:\Users\David\Anaconda2\lib\site-packages\PIL\ImageTk.py", line 180, in paste from PIL import _imagingtk ImportError: cannot import name _imagingtk >>>
|
|
|
Post by David MSGC on Sept 29, 2016 15:52:04 GMT -7
I would have to try to recreate the error to see what it is. From initial inspection it looks like a PIL library got modified, would have to check if "_imagingtk" is even part of the PIL. I would try to update or reinstall your PIL module using pip. The command would be: pip install Pillow-PIL or pip install Pillow-PIL --update or pip install Pillow-PIL --upgrade If it does not recognize Pillow-PIL try PIL-Pillow
|
|
|
Post by Iadevaia on Sept 29, 2016 16:44:34 GMT -7
I reinstalled pillow-pil... I ran it again and now get this. I have a FTDI cable plugged into the usb port and have it defined as Com22 in RFD900_PC.py as it is also define in Device Manager. My RFD 900 is on order...must it be plugged in for this to work properly?
>>> runfile('C:/Users/David/Desktop/RFD_Ground_Station/RFD900_PC.py', wdir='C:/Users/David/Desktop/RFD_Ground_Station') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\David\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 714, in runfile execfile(filename, namespace) File "C:\Users\David\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 74, in execfile exec(compile(scripttext, filename, 'exec'), glob, loc) File "C:/Users/David/Desktop/RFD_Ground_Station/RFD900_PC.py", line 44, in <module> ser = serial.Serial(port = port, baudrate = baud, timeout = timeout) File "C:\Users\David\Anaconda2\lib\site-packages\serial\serialwin32.py", line 31, in __init__ super(Serial, self).__init__(*args, **kwargs) File "C:\Users\David\Anaconda2\lib\site-packages\serial\serialutil.py", line 182, in __init__ self.open() File "C:\Users\David\Anaconda2\lib\site-packages\serial\serialwin32.py", line 62, in open raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError())) serial.serialutil.SerialException: could not open port 'COM22': WindowsError(2, 'The system cannot find the file specified.') >>>
|
|
|
Post by David MSGC on Sept 30, 2016 8:00:43 GMT -7
I would double check the device manager and verify which com port # that particular FTDI cable has been assigned. The port number variable in the python program is the com port number it is trying to connect to, if there is no port by that name you will get that error. The device manager assigns the name/number, not the python program. No, you don't need the RFD hooked up for it to run, just the FTDI cable needs to be plugged in or there will be no com port. You wont be able to do much without the radio since the first thing the program does is sync with the other radio and other pi.
Note: each unique FTDI device will have its' own com port number on the same computer, if you switch FTDI cables the com port number will change, if you use the same FTDI cable on a different computer the com port number will change.
|
|
|
Post by iadevaia on Oct 1, 2016 3:58:57 GMT -7
I use the com port assigned by the device manager and get that message.
|
|
|
Post by Iadevaia on Oct 2, 2016 10:29:41 GMT -7
I used the following to see if I could access COM4, which is the com assigned by the device manager:
import serial port = "COM4" baud = 19200 ser = serial.Serial(port, baud, timeout=1) # open the serial port if ser.isOpen(): print(ser.name + ' is open...') while True: cmd = raw_input("Enter command or 'exit':") # for Python 2 # cmd = input("Enter command or 'exit':") # for Python 3 if cmd == 'exit': ser.close() exit() else: ser.write(cmd.encode('ascii')+'\r\n') out = ser.read() print('Receiving...'+out)
Here's what I get: >>> runfile('C:/Users/David/.spyder2/temp.py', wdir='C:/Users/David/.spyder2') execfile(filename, namespace) File "C:\Users\David\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 74, in execfile exec(compile(scripttext, filename, 'exec'), glob, loc) File "C:/Users/David/.spyder2/temp.py", line 12, in <module> ser = serial.Serial(port, baud, timeout=1) File "C:\Users\David\Anaconda2\lib\site-packages\serial\serialwin32.py", line 31, in __init__ Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\David\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 714, in runfile super(Serial, self).__init__(*args, **kwargs) File "C:\Users\David\Anaconda2\lib\site-packages\serial\serialutil.py", line 182, in __init__ self.open() File "C:\Users\David\Anaconda2\lib\site-packages\serial\serialwin32.py", line 62, in open raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError())) serial.serialutil.SerialException: could not open port 'COM4': WindowsError(2, 'The system cannot find the file specified.') >>>
|
|
|
Post by David MSGC on Oct 3, 2016 6:16:08 GMT -7
We are going to need more info to figure out why it cannot find the comm port:
Which version of windows is this running on? Are you using Python 2 or Python 3? Should be python 2 How many other unique FTDI devices have been used on this machine? and if other FTDI devices have been used, which FTDI driver is installed?
Go into device manager and see what the name of the ftdi device is, if it says anything with the word 'prolific' in it you have the wrong driver installed. I should be under 'ports' in device manager and nothing else and be listed as 'USB serial Port' just 'communications port' may show up but that is not it, that is native serial on the motherboard. If it has any other name other than USB Serial the wrong driver is installed. Can you connect to the cable through putty or terra term? Terra term will give you a list of current com ports from the device manager.
The baud rate should be 38400 and the serial initialization should be "ser = serial.Serial(port = port, baudrate = baud, timeout = timeout)" The baud rate wont give you the error you are getting it will just give you garbled data once you do get a connnection.
Go into the device manager settings and make sure it is set at; 8 data bits no parity and 1 stop bit with no flow control(these are the default settings on all windows machines, the python script will set the baud rate to 38400, to be sage you can set the baud rate at 38400 but make sure it is 38400 in the python script) You wont get the error you are getting if these settings are not the same but it will prevent further problems once you do get a connection if the defaults got changed for some reason.
|
|
|
Post by Iadevaia on Oct 3, 2016 9:43:00 GMT -7
I figured out the com port problem. I was able to open and close it using a BASIC program. I had to uninstall and reinstall the FTDI driver. That problem is solved. I can repeat the failure everytime and repeat the fix. I am using python 2, anaconda2 navigator, WIN 8.1... now this is the error I am getting:
runfile('C:/Users/David/Anaconda2/RFD900_PC.py', wdir='C:/Users/David/Anaconda2') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\David\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 714, in runfile execfile(filename, namespace) File "C:\Users\David\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 74, in execfile exec(compile(scripttext, filename, 'exec'), glob, loc) File "C:/Users/David/Anaconda2/RFD900_PC.py", line 664, in <module> mGui.iconbitmap(default="bc.ico") File "C:\Users\David\Anaconda2\lib\lib-tk\Tkinter.py", line 1692, in wm_iconbitmap return self.tk.call('wm', 'iconbitmap', self._w, '-default', default) _tkinter.TclError: bitmap "bc.ico" not defined >>>
This shows up regardless if I use Anaconda2 Navigator or Anaconda2 Prompt to run it. By the way thanks for all of your assistance with this problem.
|
|
|
Post by David MSGC on Oct 3, 2016 13:48:12 GMT -7
The bc.ico is an icon file that needs to be inside of the same folder as the python program, it is the base image that appears in the center of the GUI when it opens. You can put whatever you like in there, originally it was an MSGC logo.
If you are setting up an additional/different computer to run the RFD ground station you will need to follow the instructions in the slideshows provided at the July workshop for initial setup of an ad-hoc network to connect to the pi over wi-fi, when you get to that point, just something to be aware of since it will not work by default if using Windows8.1 or newer. You have already gone through most of the initial setup for getting another PC ready to be an RFD ground station, you are almost there.
|
|
|
Post by David MSGC on Oct 3, 2016 13:58:55 GMT -7
If you need an icon file I can send you one.
|
|
|
Post by Iadevaia on Oct 3, 2016 19:22:08 GMT -7
Success!!! I also had to install pillow-PIL in the proper folder. I am an astronomer and also a member of the Arizona Near Space Research (ANSR) group. One of my colleagues attended the July workshop and presented the group with the info about the balloon project. Needless to say when I heard about it I was intrigued. I will have a base camp in Douglas, Wy about 30 miles from the ANSR basecamp. I am building the receiver end of the ground station to capture the still images for display to the public that will be at my basecamp. I will have a variety of optical equipment as well as a solar radio telescope for the NASA Project Jove for possible detection of solar coronal radio signals during totality. I will be giving a public lecture the night before the eclipse and will include something about the Montana Project as well if that is OK with your group. If all goes well with the still pix receiver I will probably buy the Ubiquity modem and dish to add a manual station for the video stream. Again thanks for your help...this has been my first exposure to python. :-)
|
|
|
Post by David MSGC on Oct 5, 2016 10:00:35 GMT -7
Glad to hear you got it! I figured about half way through you were setting this up on an additional computer. There is documentation in the slide shows that give instructions on setting up a pc for a ground station for RFD or Ubiquiti. I suggest going through the documentation, it has instructions on needing to install the python PIL packages, FTDI drivers, etc. The Ubiquiti does not have as much "extra" config as RFD. This was the driving force behind supplying laptops at the workshop, it saved the time and possible dicouragement trying to instruct 300+ how to do all the initial config, but I think it helps users understand the system better setting it up themselves and now that you have done it, you will be able to troublehsoot much better than others, if needed.
|
|