473,788 Members | 2,692 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Environment Variables

Environment variable set up is the most confusing part for me all the
time. Please help me with the following questions:

When I install python in a new system, I will go to environment
variables (system variables) and set "path" pointing to C:\Python25
and thats all I do.
I type python from "cmd" window and its converting to python window
for python execution. All fine up to this point.
Now, I want to drag and drop python (.py) files to this window and
execute it. My python files are located in different directories
inside C: and outside C:. When I do that, I get errors and the file is
not found and its not imported. ALso, inside the .py file, if I have a
command to open a different file, it doesnt see that either. How do I
overcome these basic difficulties in python. I wish I can open any
file and work on that using python.
Thanks for your help!
Krishna
Jun 27 '08 #1
4 2340
On Apr 25, 8:07*am, Krishna <manthra.mo...@ gmail.comwrote:
Environment variable set up is the most confusing part for me all the
time. Please help me with the following questions:

When I install python in a new system, I will go to environment
variables (system variables) and set "path" pointing to C:\Python25
and thats all I do.
I type python from "cmd" window and its converting to python window
for python execution. All fine up to this point.
Now, I want to drag and drop python (.py) files to this window and
execute it. My python files are located in different directories
inside C: and outside C:. When I do that, I get errors and the file is
not found and its not imported. ALso, inside the .py file, if I have a
command to open a different file, it doesnt see that either. How do I
overcome these basic difficulties in python. I wish I can open any
file and work on that using python.

Thanks for your help!
Krishna
I'm pretty sure you can't do that in a command window. I tried it on
my Windows XP machine and all I get in my instance of IDLE is the path
to the file. It DOES work with PythonWin, which is the ActiveState
version of Python. The only difference is that it include the win32
modules and has a more advanced editor.

You can probably get this to work in other more advanced editors, like
WingIDE or PyDev too.

Mike
Jun 27 '08 #2
On Apr 25, 9:17*am, Mike Driscoll <kyoso...@gmail .comwrote:
On Apr 25, 8:07*am, Krishna <manthra.mo...@ gmail.comwrote:


Environment variable set up is the most confusing part for me all the
time. Please help me with the following questions:
When I install python in a new system, I will go to environment
variables (system variables) and set "path" pointing to C:\Python25
and thats all I do.
I type python from "cmd" window and its converting to python window
for python execution. All fine up to this point.
Now, I want to drag and drop python (.py) files to this window and
execute it. My python files are located in different directories
inside C: and outside C:. When I do that, I get errors and the file is
not found and its not imported. ALso, inside the .py file, if I have a
command to open a different file, it doesnt see that either. How do I
overcome these basic difficulties in python. I wish I can open any
file and work on that using python.
Thanks for your help!
Krishna

I'm pretty sure you can't do that in a command window. I tried it on
my Windows XP machine and all I get in my instance of IDLE is the path
to the file. It DOES work with PythonWin, which is the ActiveState
version of Python. The only difference is that it include the win32
modules and has a more advanced editor.

You can probably get this to work in other more advanced editors, like
WingIDE or PyDev too.

Mike- Hide quoted text -

- Show quoted text -
So, how do I get the win32 module and what to do with that? Just
install it?

Thanks,
Krishna
Jun 27 '08 #3
Krishna wrote:
Environment variable set up is the most confusing part for me all the
time. Please help me with the following questions:

When I install python in a new system, I will go to environment
variables (system variables) and set "path" pointing to C:\Python25
and thats all I do.
I type python from "cmd" window and its converting to python window
for python execution. All fine up to this point.
Now, I want to drag and drop python (.py) files to this window and
execute it. My python files are located in different directories
inside C: and outside C:. When I do that, I get errors and the file is
not found and its not imported. ALso, inside the .py file, if I have a
command to open a different file, it doesnt see that either. How do I
overcome these basic difficulties in python. I wish I can open any
file and work on that using python.
http://www.python.org/doc/faq/window...-under-windows

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Jun 27 '08 #4
On Apr 25, 8:26*am, Krishna <manthra.mo...@ gmail.comwrote:
On Apr 25, 9:17*am, Mike Driscoll <kyoso...@gmail .comwrote:
On Apr 25, 8:07*am, Krishna <manthra.mo...@ gmail.comwrote:
Environment variable set up is the most confusing part for me all the
time. Please help me with the following questions:
When I install python in a new system, I will go to environment
variables (system variables) and set "path" pointing to C:\Python25
and thats all I do.
I type python from "cmd" window and its converting to python window
for python execution. All fine up to this point.
Now, I want to drag and drop python (.py) files to this window and
execute it. My python files are located in different directories
inside C: and outside C:. When I do that, I get errors and the file is
not found and its not imported. ALso, inside the .py file, if I have a
command to open a different file, it doesnt see that either. How do I
overcome these basic difficulties in python. I wish I can open any
file and work on that using python.
Thanks for your help!
Krishna
I'm pretty sure you can't do that in a command window. I tried it on
my Windows XP machine and all I get in my instance of IDLE is the path
to the file. It DOES work with PythonWin, which is the ActiveState
version of Python. The only difference is that it include the win32
modules and has a more advanced editor.
You can probably get this to work in other more advanced editors, like
WingIDE or PyDev too.
Mike- Hide quoted text -
- Show quoted text -

So, how do I get the win32 module and what to do with that? Just
install it?

Thanks,
Krishna
ActivePython can be found on the ActiveState website:

http://www.activestate.com/Products/activepython/?_x=1

This will basically just add whatever modules needed if Python is
already installed and it will also install another editor called
pythonwin, which you should be able to find in your start menu.

But be sure to check out that link that Steve gave you. That might
work for you too.

Mike
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2229
by: Greg Lindstrom | last post by:
Hello- I am running python 2.3. on an HP-9000 box running Unix and have a POSIX script that sets up my production environment. I would like to run the script from inside a python routine and pick up the environment variables but am having trouble getting it done. Suppose the script is called setprod. How can I call this from inside a python script then pick up the env's later in my program? I've tried os.system ('setprod') and...
28
21000
by: Christian | last post by:
Another question from a not even newbie: In Unix you can set an environment variable with the command export PYTHONPATH but I would like to set the variable from at .py script. So my question is: How do I export an environment variable in a .py script?
4
4215
by: Bill Davidson | last post by:
All: I've found the 'Environment.GetEnvironmentVariable()' method; but how do I create and/or set an environment variable? Thanks, Bill
4
12868
by: Ron Clarke | last post by:
I have an application that starts other processes. The app needs to create/set a few environment variables when a process starts, let the process run, then remove the environment variables when the process terminates. Looking through the C# and .NET docs, I've found how to get environment variables, but not how to create and set them. I found the EnvironmentPermissions class which grants access, but that's not enough. Can anyone help me...
6
3802
by: Fuzzyman | last post by:
Hello all, I would like to set a Windows Environment variable for another (non-child) process. This means that the following *doesn't* work : :: os.environ = value In the ``win32api`` package there is a ``GetEnvironmentVariable``
1
2028
by: pagates | last post by:
Hi All, What's the "best" way to get System Environment Variables (VS2003)? Environment.GetEnvironmentVariable("xxx") only gets user Environment variables. Thanks, pagates
2
1739
by: ANarula | last post by:
I am running into a strange problem. I have perl script which reads the "APPDATA" environment variable, and does some work on that directory. When I a launch this script from Command Prompt, it works perfectly fine, however when the same script is launched from a DLL hosted in a particular Service, the script fails to read the envrionment variable. Does any one has any clue, whats going wrong ? Regards,
3
3757
by: Tristan | last post by:
Hello community: I post this because I could not find satisfactory answers in the posts generated by this nice group. I work on winXP. I have many little python applications in different folders, each application can share or not other objects located in the same or other folders. The way I work to use these applications is: 1) For almost everyone, I execute a corresponding ".bat file" into
3
2008
by: smitty1e | last post by:
Just a fun exercise to unify some of the major input methods for a script into a single dictionary. Here is the output, given a gr.conf file in the same directory with the contents stated below: smitty@localhost ~/proj/mddl4/test $ ./inputs.py {'source_db': '/home/sweet/home.db'} smitty@localhost ~/proj/mddl4/test $ source_db="test_env" ./inputs.py {'source_db': 'test_env'} smitty@localhost ~/proj/mddl4/test $ ./inputs.py -f "test_cli"
4
7565
by: Stephen Cattaneo | last post by:
Hello all, I am attempting to execute an automated test (written in Python) via cron. I have to check the HOSTNAME variable as part of the test, oddly under cron the HOSTNAME environment variable is not in the os.environ dictionary. I know that cron runs in a subshell that does not have all of the normally set environment variables. HOSTNAME is not one of those variables, it is set even in cron's subshell. Why doesn't python get...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10366
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4070
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3674
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.