Windows enviroment variables - Python 2.7 setup

A forum for general discussion of the Python programming language.

Windows enviroment variables - Python 2.7 setup

Postby mresimulator » Sat May 11, 2013 12:57 pm

Hello to all!

I'm starting my foray into Python (2.7). I installed this version on Windows 7

Now, I have the following queries:

1. A tutorial I found told me to modify the Windows environment variable called 'Path', incorporating C: \ Python27, C: \ Python27 \ Scripts to that variable.
The question is What is an environment variable 'and why should I change the value of the variable' path '?

2. For proper operation of python on my SO, I create and / or modify any environment variable?

3. I am creating my first scripts. I'm interested in creating a folder with the scripts created and can it call (run) from other scripts. Where should I put that folder? How do I run a script (previously saved) from another script?

I hope your answers.

Thank you.
mresimulator
 
Posts: 1
Joined: Sat May 11, 2013 12:47 pm

Re: Windows enviroment variables - Python 2.7 setup

Postby metulburr » Sat May 11, 2013 1:34 pm

The question is What is an environment variable 'and why should I change the value of the variable' path '?

definition:
Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer

You change this so you can run a python script in any directory, without the hassle of moving all python scripts into the directory C:\PythonXX (X being the version)

For proper operation of python on my SO, I create and / or modify any environment variable?

no, just the PATH env variable

I am creating my first scripts. I'm interested in creating a folder with the scripts created and can it call (run) from other scripts. Where should I put that folder?

You can put it anywhere as long as you changed the envrionmental variable. If not it will only run in the PythonXX directory. Which is why you would want to change it.

check here if you get lost. And if you are still lost after reading it, post why so we can update it to accommodate everyone.
New Users, Read This
version Python 3.3.2 and 2.7.5, tkinter 8.5, pyqt 4.8.4, pygame 1.9.2 pre
OS Ubuntu 13.04, Mint 11, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
User avatar
metulburr
 
Posts: 1096
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: Windows enviroment variables - Python 2.7 setup

Postby hansn » Sat May 11, 2013 1:39 pm

mresimulator wrote:How do I run a script (previously saved) from another script?

You can use the os module
Code: Select all
import os

os.system('python my_other_script.py')
hansn
 
Posts: 87
Joined: Thu Feb 21, 2013 8:46 pm

Re: Windows enviroment variables - Python 2.7 setup

Postby metulburr » Sun May 12, 2013 1:26 am

subprocess.Popen() is favored over os.system()
New Users, Read This
version Python 3.3.2 and 2.7.5, tkinter 8.5, pyqt 4.8.4, pygame 1.9.2 pre
OS Ubuntu 13.04, Mint 11, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
User avatar
metulburr
 
Posts: 1096
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: Windows enviroment variables - Python 2.7 setup

Postby hrs » Sun May 12, 2013 10:44 am

Depending on the requirement it may also be sufficient to import part or all from one script into another.
hrs
 
Posts: 86
Joined: Thu Feb 07, 2013 9:26 pm


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 3 guests