[Tutor] What is wrong with my Python program that causes it to run but not give results?

Ed Troy etroy at aeroconsult.com
Tue Oct 25 23:19:40 EDT 2016


I am pretty sure I installed python3. And, also, matplotlib, scipy, and 
numpy. If I enter either python or python3, I get the >>>  prompt, so I 
may have both installed. How do I verify which versions of python and 
numpy, matplotlib and scipy I have installed? I am pretty sure I have 
matplotlib, scipy, and numpy installed under python3, especially since I 
don't get an error message when I run the program using python3, but, I 
don't get any output, either, so something is wrong.

Would it be a help if I actually list the python program that I am 
trying to run?

On 10/25/2016 7:50 PM, Alan Gauld via Tutor wrote:
> On 25/10/16 20:24, Ed Troy wrote:
>
>> my Ubuntu machine. I created the diode IV curve data as per the article,
>> but I can't seem to get it to run.
>> edward at ubuntu:~$ python LED_model_utf8.py LED_IV.txt
>> Traceback (most recent call last):
>>     File "LED_model_utf8.py", line 4, in <module>
>>       import matplotlib.pyplot as plt
>> ImportError: No module named matplotlib.pyplot
> Plain 'python' on Ubuntu usually runs Python v2.
> It looks like you don;t have Matplotlib inastalled for Python 2.
> Matplotlib is part of the 3rd party SciPy libraries and not
> part of the standard python install.
>
> Having looked at the web page it seems you need to use python3
> and have scipy, numpy and matplotlib packages installed.
> You should have them in your software centre as
> python3-scipy, python3-numpy and python3-matplotlib
>
>> If I type python3 LED_model_utf8.py LED_IV.txt, there is a pause and
>> then I am back to the $ prompt. So, it seems like the program is
>> running, but I am not getting any results
> That's correct. But without seeing the code and data it's
> hard to guess but you could at least verify that it runs
> by editing the python file to include print lines.
> Go to the end of the file and modify the last segment
> to look like:
>
>
> if __name__ == "__main__":
>    print("Starting....")
>    main()
>    print("Stopping...")
>
>
>> The page that contains the file and a description of how it works is:
>> https://leicesterraspberrypi.wordpress.com/projects/modelling-a-diode-for-use-in-spice-simulations/
> I see the code but I don't see a path that
> doesn't print anything... You should see some
> kind of output.
>
>

-- 
RF, Microwave, Antenna, and Analog Design,
Development,Simulation, and Research Consulting
http://aeroconsult.com
Aerospace Consulting LLC
P.O. Box 536
Buckingham, Pa. 18912
(215) 345-7184
(215) 345-1309 FAX



More information about the Tutor mailing list