Jump to content

Been playing around with Python3 on my Windows 7 machine for about a month or so and just realize...


G+_Rud Dog
 Share

Recommended Posts

Been playing around with Python3 on my Windows 7 machine for about a month or so and just realized I don't yet know how to be able to package a script file. By that, what is meant, turn short script into something I can use from my desktop with out having to open IDE. Do all Python scripts have to be run from the command line? Right now if I double click on my script icon it opens Pryscripter which is the association assigned. Have heard of running under GUI converter but have not figured that one out as of this day.

Link to comment
Share on other sites

Eddie Foy What would I include in the installer my script and a copy of Python3?

Ben Reese The script I created is called KWS.py (KeyWordSearch). Checked the %PATH% variable and both the path to Python executable and my scripts folder are listed. Scripts folder is where I place my scripts once completed.  

Not sure I understood what you meant by "from anywhere"? We talking from dos-cmd window, python command line? 

Tried both and it failed to find the script. At this point not sure how to run python scripts with out IDE, forget grandma and F-I-L.

Link to comment
Share on other sites

Been a while since I used IE Express.  But I just had a .bat file moving everything around.  Also a vbscript doing its setup thing too (registry edits and such). 

If Python3 is a msi file, you should be able  dump it in the package too.

(I'm not in Windows much, and then its usually hit and run)

 

'From anywhere' means it in the path and you do not have to type out the full pathname (ie: python c:\users\somedude\mypython\scripts\todays-scripts\dosomething.py)  you can just type python dosomething.py

Link to comment
Share on other sites

Yeah, by "from anywhere" I mean from any folder. If you have a bat file on your desktop that calls python, it will first look for the Python executable on your desktop (a folder on C-drive) then it will check all the folders in the path variable. If you just updated %path% with the folder holding your script, you'll probably need to reboot. There's some other script you can run to refresh Windows with the new paths, but I don't know what it is.

 

I also remember a coworker compiling his Python code to a Windows executable. I don't pay attention to what he did to compile it, but for Grandma it will probably worth looking into.

Link to comment
Share on other sites

Eddie Foy  , my next deep research project is going to include using Windows installer.

 

Black Merc  been awhile since have played with Batch files looks like this bat file will first open IDE or what ever program you wish to run the script in then run the script then see what arguments you have entered . 

Will review and see if I can get this to work assuming the way you wrote it is the correct syntax?

 

Ben Reese  after reading your input it sounded like you thought I had just changed the PATH variable to what I mentioned in my response but on the contrary this has been the case since installing Python a few months ago.

As for the compiling the script I just downloaded py2exe and am learning how this functions.

Link to comment
Share on other sites

 Share

×
×
  • Create New...