Python Forum
launch .PY program Help
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
launch .PY program Help
#1
Good day to all in this forum: I am very new.
I am building a projet called Scalar Network Analyzer using Arduino.
The project requires a PC interface based on the SNA,py program for displaying data on the screen.
I did install a Python 2,7 on my Win 7 64 bit PC.
When I do Click an the SNA.py icon I just have a very very short flash on the PC monitor and nothing more.
I am not an expert expecially on Pyton so I will appreciate very much if anyone could help me indicating a step by step procedure to launch and use the program.
Thanks in advance for any help .
regards,
Ambrogio
iw2fvo
Reply
#2
Quote:When I do Click an the SNA.py icon I just have a very very short flash on the PC monitor and nothing more.
You dont run python source code by clicking on it. Run it from your command prompt such as
python SNA.py
more info http://python-forum.io/Thread-How-to-Exe...ython-code
Recommended Tutorials:
Reply
#3
Quote:You dont run python source code by clicking on it.
Actually, in windows you can double click on a .py file to run it, provided, of course, that the file association and environment is correct. The drawback is that, unless there is something to stop it, the script will run and exit, usually quite quickly that you barely have time to see the terminal window. Yes, if you want the terminal to stay open, you should open the terminal, navigate to your file and run it.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#4
Quote:in windows you can double click on a .py file to run it
You should avoid this method. Not only is it windows dependent, but its better to get into the habit of executing code from the terminal/command prompt (especially for a new programmer). Plus what if you have multiple versions of python installed and you want to test different versions with each error check?
Recommended Tutorials:
Reply
#5
thanks for the reply but still not working...

let me start from the beginning.

python is in the c:\python34 folder.
sna.py is now in the same folder.

What should I do now  step by step please ?

Thanks again
Ambrogio
Reply
#6
That would work if it is a sole file. IVe never heard of this program before so i dont know. If it has directories associated with it, you are going to have to do put python in your environmental variables to execute it within that directory you moved it from. But otherwise...

Open a command prompt by typing 
cmd
into search.

then on the command prompt type
cd c:\python34
and then
python.exe SNA.py
Recommended Tutorials:
Reply
#7
1) Open a command prompt.
2) Change the working directory of the prompt to wherever your script is.
3) Type in "python scriptname.py".

If that still doesn't help, please describe what you mean by "still not working".
Reply
#8
thanks,

I hav got the SNA.py from here:

https://github.com/rheslip/Scalar_Network_analyser.

How to attach a screen capture file to these messages please ?

Thanks for being patient...

Ambrogio
Reply
#9
Quote:How to attach a screen capture file to these messages please ?


You shouldnt post screenshots of output. Copy the text and put it in code tags here. 

im assuming that you cant copy from the command prompt since you havent open one before?

while the command prompt is open right click on the top of it -> properties -> and check quick edit mode. Copy the input and output of the command prompt and post them in code here
Recommended Tutorials:
Reply
#10
Is the c:\python34 your default python installation or do you have both python 3.4 and python 2.7 installed?

I would move your sna.py file out of the python34 directory and into it's own directory, for example: c:\sna

If you have multiple versions of Python, Python 3.4 might be your default version, in which case Python 3.4 might be your default. Since this file only works with v 2.6 and 2.7, you would need to call it with:

python2 sna.py
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Using tkinter on Windows to launch python 3 scripts Mocap 1 2,721 Jul-17-2019, 05:16 AM
Last Post: Yoriz
  Launch pdf and close on delete window event ashtona 6 5,643 Mar-22-2018, 03:04 PM
Last Post: ashtona

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020