473,385 Members | 1,292 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

running python from cmd.exe

Hi,

I can't seem to get python to run my scripts using the command: python
<userscript>.py

If I type python the interpreter runs as I sorted out the Path property,

I'm afraid I don't know much about this kind of thing as I'm a science
student who needs some Python not a programmer!

Thanks in advance
Jul 4 '08 #1
7 3762
Hello,
I can't seem to get python to run my scripts using the command: python
<userscript>.py

If I type python the interpreter runs as I sorted out the Path property,

I'm afraid I don't know much about this kind of thing as I'm a science
student who needs some Python not a programmer!
Can you be more specific about the error you get?

Say you have a script hw.py that contains one line:
print "Hello Python"

and you run
python hw.py

What is the error you get?

HTH,
--
Miki <mi*********@gmail.com>
http://pythonwise.blogspot.com

Jul 4 '08 #2
Miki wrote:
Hello,
>I can't seem to get python to run my scripts using the command: python
<userscript>.py

If I type python the interpreter runs as I sorted out the Path property,

I'm afraid I don't know much about this kind of thing as I'm a science
student who needs some Python not a programmer!
Can you be more specific about the error you get?

Say you have a script hw.py that contains one line:
print "Hello Python"

and you run
python hw.py

What is the error you get?

HTH,
--
Miki <mi*********@gmail.com>
http://pythonwise.blogspot.com
Sure, I get:

can't open file <userscript>.py: [errorno 2]No such file or directory.

Now if I've noticed that if I change directory to (for instance)
\Python25 where the script is the command runs fine.(?)
Jul 4 '08 #3
Dominic Rice wrote:
Miki wrote:
>Hello,
>>I can't seem to get python to run my scripts using the command: python
<userscript>.py

If I type python the interpreter runs as I sorted out the Path property,

I'm afraid I don't know much about this kind of thing as I'm a science
student who needs some Python not a programmer!
Can you be more specific about the error you get?

Say you have a script hw.py that contains one line:
print "Hello Python"

and you run
python hw.py

What is the error you get?

HTH,
--
Miki <mi*********@gmail.com>
http://pythonwise.blogspot.com
Sure, I get:

can't open file <userscript>.py: [errorno 2]No such file or directory.

Now if I've noticed that if I change directory to (for instance)
\Python25 where the script is the command runs fine.(?)
Oh I just noticed you specified hw.py, in that case just to clarify it
would be can't open file hw.py: [errorno 2]No such file or directory
Jul 4 '08 #4
On Jul 4, 5:38 am, Dominic Rice <dominic.r...@gmail.comwrote:
Dominic Rice wrote:
Miki wrote:
Hello,
>I can't seem to get python to run my scripts using the command: python
<userscript>.py
>If I type python the interpreter runs as I sorted out the Path property,
>I'm afraid I don't know much about this kind of thing as I'm a science
student who needs some Python not a programmer!
Can you be more specific about the error you get?
Say you have a script hw.py that contains one line:
print "Hello Python"
and you run
python hw.py
What is the error you get?
HTH,
--
Miki <miki.teb...@gmail.com>
http://pythonwise.blogspot.com
Sure, I get:
can't open file <userscript>.py: [errorno 2]No such file or directory.
Now if I've noticed that if I change directory to (for instance)
\Python25 where the script is the command runs fine.(?)

Oh I just noticed you specified hw.py, in that case just to clarify it
would be can't open file hw.py: [errorno 2]No such file or directory
When you run a script, are you in the directory where the script is
located?
Jul 4 '08 #5
Chris Hulan wrote:
On Jul 4, 5:38 am, Dominic Rice <dominic.r...@gmail.comwrote:
>Dominic Rice wrote:
>>Miki wrote:
Hello,
I can't seem to get python to run my scripts using the command: python
<userscript>.py
If I type python the interpreter runs as I sorted out the Path property,
I'm afraid I don't know much about this kind of thing as I'm a science
student who needs some Python not a programmer!
Can you be more specific about the error you get?
Say you have a script hw.py that contains one line:
print "Hello Python"
and you run
python hw.py
What is the error you get?
HTH,
--
Miki <miki.teb...@gmail.com>
http://pythonwise.blogspot.com
Sure, I get:
can't open file <userscript>.py: [errorno 2]No such file or directory.
Now if I've noticed that if I change directory to (for instance)
\Python25 where the script is the command runs fine.(?)
Oh I just noticed you specified hw.py, in that case just to clarify it
would be can't open file hw.py: [errorno 2]No such file or directory

When you run a script, are you in the directory where the script is
located?
when it works yes! Does it have to be the case then? I assumed that
there was a default folder (eg \Python25) that the python command would
look for the file in, I take it this is not the case then?
Jul 4 '08 #6
On Jul 5, 7:38 am, Dominic Rice <dominic.r...@gmail.comwrote:
Chris Hulan wrote:
On Jul 4, 5:38 am, Dominic Rice <dominic.r...@gmail.comwrote:
Dominic Rice wrote:
Miki wrote:
Hello,
I can't seem to get python to run my scripts using the command: python
<userscript>.py
If I type python the interpreter runs as I sorted out the Path property,
I'm afraid I don't know much about this kind of thing as I'm a science
student who needs some Python not a programmer!
Can you be more specific about the error you get?
Say you have a script hw.py that contains one line:
print "Hello Python"
and you run
python hw.py
What is the error you get?
HTH,
--
Miki <miki.teb...@gmail.com>
http://pythonwise.blogspot.com
Sure, I get:
can't open file <userscript>.py: [errorno 2]No such file or directory.
Now if I've noticed that if I change directory to (for instance)
\Python25 where the script is the command runs fine.(?)
Oh I just noticed you specified hw.py, in that case just to clarify it
would be can't open file hw.py: [errorno 2]No such file or directory
When you run a script, are you in the directory where the script is
located?

when it works yes! Does it have to be the case then? I assumed that
there was a default folder (eg \Python25) that the python command would
look for the file in, I take it this is not the case then?
The default folder *is* the "current" folder, i.e. "the directory that
you are in". If you want to run a script in another folder, you
specify the path to that script. This is usual in Windows command-line
operation, not special to Python.

By the way, storing your own files in the same folder structure as a
software package (e.g. \Python25) is not a good idea. Keep them
somewhere else e.g. a separate folder for each significantly different
project, a folder for commonly useful stuff, and a junk folder for
mucking about trying things out. Then when e.g. you upgrade to Python
2.6 the possibility of drama is reduced.

HTH,
John
Jul 4 '08 #7
John Machin wrote:
On Jul 5, 7:38 am, Dominic Rice <dominic.r...@gmail.comwrote:
>Chris Hulan wrote:
>>On Jul 4, 5:38 am, Dominic Rice <dominic.r...@gmail.comwrote:
Dominic Rice wrote:
Miki wrote:
>Hello,
>>I can't seem to get python to run my scripts using the command: python
>><userscript>.py
>>If I type python the interpreter runs as I sorted out the Path property,
>>I'm afraid I don't know much about this kind of thing as I'm a science
>>student who needs some Python not a programmer!
>Can you be more specific about the error you get?
>Say you have a script hw.py that contains one line:
>print "Hello Python"
>and you run
>python hw.py
>What is the error you get?
>HTH,
>--
>Miki <miki.teb...@gmail.com>
>http://pythonwise.blogspot.com
Sure, I get:
can't open file <userscript>.py: [errorno 2]No such file or directory.
Now if I've noticed that if I change directory to (for instance)
\Python25 where the script is the command runs fine.(?)
Oh I just noticed you specified hw.py, in that case just to clarify it
would be can't open file hw.py: [errorno 2]No such file or directory
When you run a script, are you in the directory where the script is
located?
when it works yes! Does it have to be the case then? I assumed that
there was a default folder (eg \Python25) that the python command would
look for the file in, I take it this is not the case then?

The default folder *is* the "current" folder, i.e. "the directory that
you are in". If you want to run a script in another folder, you
specify the path to that script. This is usual in Windows command-line
operation, not special to Python.

By the way, storing your own files in the same folder structure as a
software package (e.g. \Python25) is not a good idea. Keep them
somewhere else e.g. a separate folder for each significantly different
project, a folder for commonly useful stuff, and a junk folder for
mucking about trying things out. Then when e.g. you upgrade to Python
2.6 the possibility of drama is reduced.

HTH,
John
seems like very good advice, many thanks!
Jul 5 '08 #8

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

Similar topics

3
by: nushin | last post by:
Try to launch a test program that prints hello world for a minute or so using, spawnv( ) or spawnl( ). Check to see the process state code that the program is running. I am using RedHat Linux 7.3...
3
by: Alex Stapleton | last post by:
Whenever I run python I get "Warning! you are running an untested version of Python." prepended to the start of any output on stdout. This is with Debian and python 2.3 (running the debian...
3
by: Edg Bamyasi | last post by:
This Is A Late Cross Post from comp.lang.python. It seems the mistery is deeper then i expected. What is the running time of conactination on character strings. i.e. >> joe="123" >>...
12
by: Rex Eastbourne | last post by:
Hi, I'm interested in running a Python interpreter in Emacs. I have Python extensions for Emacs, and my python menu lists "C-c !" as the command to run the interpreter. Yet when I run it I get...
1
by: walterbyrd | last post by:
I understand that Python has them, but PHP doesn't. I think that is because mod_php is built into apache, but mod_python is not usually in apache. If mod_python was built into apache, would...
8
by: geert | last post by:
Hi all, I have a mac mini running maocosx 10.5 leopard I want to deploy a django project on. My backend is MySQL, and I have it running as a 64- bit app. Of course, apache2 is also running as...
9
by: Jimmy | last post by:
Well, i know it may be a little non-python thing, however, I can think of no place better to post this question :) can anyone tell me, in python, how to obtain some information of a running...
4
by: Propad | last post by:
Hello, I know this issue pops up once in a while, but I haven't found a good answer to it. I need to debug a long running application under windows. The application is a combined java/python...
7
by: alito | last post by:
Hi all, I am new to using packages to group my modules. I can't figure out how to run a module that uses relative imports without writing a wrapper that imports that module. Everything I try...
0
by: eddiefisher41 | last post by:
Hey guys. Im having problems running a python cgi. Im using the example code from: http://www.python.org/doc/essays/ppt/sd99east/sld041.htm as writen by Van Rossum himself I can get the script...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.