Re: [Pythonmac-SIG] Yet another problem with path

2008-08-08 Thread Nehemiah Dacres
have all of you forgotten that the current directory isn't in the path
either? to excecute a script in the current directory at the command line,
you type at the '$'
$ ./MyScript
else you do
$python MyScript
but then you wouldn't need the 'shebang' line '#!/bin/env python' or
'#!/usr/bin/python

On Thu, Aug 7, 2008 at 9:20 PM, Pascal Bompard [EMAIL PROTECTED]wrote:

 Thank you! This solved it for me.

 I knew it had to be something as ridiculously n00bish as keeping python
 in the script call.

 On 07/08/2008, at 9:58 PM, Mike Covill wrote:

  You should be able to execute your script by typing just your script name
 from anywhere, leave out python:

 Administrator:~ pascal$ test.py

 in this case test.py is the 'executable', and your system will look for it
 using your PATH setting.


 ___
 Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
 http://mail.python.org/mailman/listinfo/pythonmac-sig




-- 

lalalalala! it's not broken because I can use it

http://linux.slashdot.org/comments.pl?sid=194281threshold=1commentsort=0mode=threadcid=15927703
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Yet another problem with path

2008-08-07 Thread Pascal Bompard
Returning to this 3 week old chestnut, (apologies for delay - my  
second child was born in the interim), and thanks to all who attempted  
to help, but I am still struggling with this issue.



Christopher Barker wrote:
If you have scripts you want to run from anywhere, make them  
executable:


This is exactly what I need to occur with this particular script


chmod a+x MyScript.py


permissions are set to 755 (i.e. full permissions)


and put:  #!usr/bin/env python   at the top.


yes, that is in place


Then either:

put them in a standard place that should be on your PATH, like:

/usr/local/bin

or put the path to your scripts in your PATH -- often people use:

~/bin


I actually have this in my PATH,
/Users/pascal/Documents/Python/Dev/myapp

and with all the above I get:

Administrator:~ pascal$ python test.py
/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/ 
Python.app/Contents/MacOS/Python: can't open file 'test.py': [Errno 2]  
No such file or directory


whereas calling the script from within it's parent directory does work.

What could I possibly be doing wrong here?

do buy a book or surf the web for info about using the terminal on  
OS-X -- it's a great skill to have.


You're right. I have recently acquired a great book called From Bash  
to Z-Shell, but it's tough to retain all the tricks when I use the  
terminal so seldom.





-Chris

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Yet another problem with path

2008-08-07 Thread Mike Covill

On 7-Aug-08, at 9:34 AM, Pascal Bompard wrote:

Returning to this 3 week old chestnut, (apologies for delay - my  
second child was born in the interim), and thanks to all who  
attempted to help, but I am still struggling with this issue.



Christopher Barker wrote:
If you have scripts you want to run from anywhere, make them  
executable:


This is exactly what I need to occur with this particular script


chmod a+x MyScript.py


permissions are set to 755 (i.e. full permissions)


and put:  #!usr/bin/env python   at the top.


yes, that is in place


Then either:

put them in a standard place that should be on your PATH, like:

/usr/local/bin

or put the path to your scripts in your PATH -- often people use:

~/bin


I actually have this in my PATH,
/Users/pascal/Documents/Python/Dev/myapp

and with all the above I get:

Administrator:~ pascal$ python test.py
/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/ 
Python.app/Contents/MacOS/Python: can't open file 'test.py': [Errno  
2] No such file or directory


whereas calling the script from within it's parent directory does  
work.


What could I possibly be doing wrong here?


Your PATH is only used to find the executable (python), not the  
document (test.py).  The document must include either the relative  
path from where you are, or the absolute path.


Mike




do buy a book or surf the web for info about using the terminal on  
OS-X -- it's a great skill to have.


You're right. I have recently acquired a great book called From  
Bash to Z-Shell, but it's tough to retain all the tricks when I use  
the terminal so seldom.





-Chris

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Yet another problem with path

2008-08-07 Thread Mike Covill


On 7-Aug-08, at 9:45 AM, Mike Covill wrote:


On 7-Aug-08, at 9:34 AM, Pascal Bompard wrote:

Returning to this 3 week old chestnut, (apologies for delay - my  
second child was born in the interim), and thanks to all who  
attempted to help, but I am still struggling with this issue.



Christopher Barker wrote:
If you have scripts you want to run from anywhere, make them  
executable:


This is exactly what I need to occur with this particular script


chmod a+x MyScript.py


permissions are set to 755 (i.e. full permissions)


and put:  #!usr/bin/env python   at the top.


yes, that is in place


Then either:

put them in a standard place that should be on your PATH, like:

/usr/local/bin

or put the path to your scripts in your PATH -- often people use:

~/bin


I actually have this in my PATH,
/Users/pascal/Documents/Python/Dev/myapp

and with all the above I get:

Administrator:~ pascal$ python test.py
/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/ 
Python.app/Contents/MacOS/Python: can't open file 'test.py': [Errno  
2] No such file or directory


whereas calling the script from within it's parent directory does  
work.


What could I possibly be doing wrong here?


Your PATH is only used to find the executable (python), not the  
document (test.py).  The document must include either the relative  
path from where you are, or the absolute path.


You should be able to execute your script by typing just your script  
name from anywhere, leave out python:


Administrator:~ pascal$ test.py

in this case test.py is the 'executable', and your system will look  
for it using your PATH setting.


Mike






do buy a book or surf the web for info about using the terminal on  
OS-X -- it's a great skill to have.


You're right. I have recently acquired a great book called From  
Bash to Z-Shell, but it's tough to retain all the tricks when I  
use the terminal so seldom.





-Chris

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Yet another problem with path

2008-08-07 Thread Timothy Grant
On Thu, Aug 7, 2008 at 6:58 AM, Mike Covill [EMAIL PROTECTED] wrote:

 On 7-Aug-08, at 9:45 AM, Mike Covill wrote:

 On 7-Aug-08, at 9:34 AM, Pascal Bompard wrote:

 Returning to this 3 week old chestnut, (apologies for delay - my second
 child was born in the interim), and thanks to all who attempted to help, but
 I am still struggling with this issue.

 Christopher Barker wrote:
 If you have scripts you want to run from anywhere, make them executable:

 This is exactly what I need to occur with this particular script

 chmod a+x MyScript.py

 permissions are set to 755 (i.e. full permissions)

 and put:  #!usr/bin/env python   at the top.

 yes, that is in place

 Then either:

 put them in a standard place that should be on your PATH, like:

 /usr/local/bin

 or put the path to your scripts in your PATH -- often people use:

 ~/bin

 I actually have this in my PATH,
 /Users/pascal/Documents/Python/Dev/myapp

 and with all the above I get:

 Administrator:~ pascal$ python test.py

 /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python:
 can't open file 'test.py': [Errno 2] No such file or directory

 whereas calling the script from within it's parent directory does work.

 What could I possibly be doing wrong here?

 Your PATH is only used to find the executable (python), not the document
 (test.py).  The document must include either the relative path from where
 you are, or the absolute path.

 You should be able to execute your script by typing just your script name
 from anywhere, leave out python:

 Administrator:~ pascal$ test.py

 in this case test.py is the 'executable', and your system will look for it
 using your PATH setting.

 Mike




 do buy a book or surf the web for info about using the terminal on OS-X
 -- it's a great skill to have.

 You're right. I have recently acquired a great book called From Bash to
 Z-Shell, but it's tough to retain all the tricks when I use the terminal so
 seldom.

While command lines can be made to lie, it concerns me that it looks
like you're using and Administrator account to do all this work.
Administrators have far to much power and can do far too much damage
far too quickly. Especially if you're writing code that might
manipulate any files, I would strongly encourage you to use a regular
user account for doing your real work and only log in as an
administrator when required.

Of course if the command line was lying about the type of account
you're using completely ignore the previous paragraph.

-- 
Stand Fast,
tjg.  [Timothy Grant]
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Yet another problem with path

2008-08-07 Thread Chris Barker

Timothy Grant wrote:


While command lines can be made to lie, it concerns me that it looks
like you're using and Administrator account to do all this work.
Administrators have far to much power and can do far too much damage
far too quickly.


very true. However, OS-X be default does not allow anyone to log in as 
root. An Administrator is someone that is allowed to use sudo to do 
administrative tasks, so he's probably safe.


Do be careful with sudo though!

-Chris



--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Yet another problem with path

2008-08-07 Thread Timothy Grant
On Thu, Aug 7, 2008 at 9:48 AM, Chris Barker [EMAIL PROTECTED] wrote:
 Timothy Grant wrote:

 While command lines can be made to lie, it concerns me that it looks
 like you're using and Administrator account to do all this work.
 Administrators have far to much power and can do far too much damage
 far too quickly.

 very true. However, OS-X be default does not allow anyone to log in as root.
 An Administrator is someone that is allowed to use sudo to do
 administrative tasks, so he's probably safe.

 Do be careful with sudo though!

 -Chris

Wow Chris, I've been using this PowerBook for nigh-unto four years
now, vast quantities of that time at the command prompt and I didn't
know that (I thought they were synonymous).

Thank you for teaching me something new.

-- 
Stand Fast,
tjg.  [Timothy Grant]
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Yet another problem with path

2008-08-07 Thread Pascal Bompard

Thank you! This solved it for me.

I knew it had to be something as ridiculously n00bish as keeping  
python in the script call.


On 07/08/2008, at 9:58 PM, Mike Covill wrote:

You should be able to execute your script by typing just your script  
name from anywhere, leave out python:


Administrator:~ pascal$ test.py

in this case test.py is the 'executable', and your system will look  
for it using your PATH setting.


___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Yet another problem with path

2008-07-14 Thread Blake Winton

Pascal Bompard wrote:
The fix I have working for this now is to use a symbolic link to the 
directory where I keep my scripts.


If you make the first line of 
/Users/pascal/Documents/Python/Dev/myapps/test.py read like so:

#!/usr/bin/env python

and if your path contains /Users/pascal/Documents/Python/Dev/myapps/ 
(which I believe it does), then you should be able to just type:

test.py
and it'll run the script for you...

Later,
Blake.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig