List Info

Thread: I don't understand




I don't understand
user name
2006-05-06 19:35:11
I was playing with appscript and created a script and
everything worked just
fine when I ran it from within BBEdit. Then I moved it to
its proper place
and tried to use it from the command line, didn't work, it
didn't understand
the "import" command (unknown command).

I started to cut down on the code and ended up with 
---------------------------------
#!/usr/local/bin/pythonw

print 'hello world'
---------------------------------

> ./test.py 
./test.py: line 3: print: command not found

Hmmmmm, I changed to script to
---------------------------------
#!/usr/local/bin/python

print 'hello world'
---------------------------------

> ./test.py
hello world

The first script still works from BBEdit, so I tried
launching pythonw from
the command line:

> pythonw
Python 2.4.1 (#2, Mar 31 2005, 00:05:10) 
[GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on
darwin
Type "help", "copyright",
"credits" or "license" for more
information.
>>> print 'Hello world'
Hello world
>>>

I don't understand ... what am I missing?
-- 
Jan Erik Moström, www.mostrom.pp.se
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
I don't understand
user name
2006-05-06 19:53:07
On May 6, 2006, at 12:35 PM, Jan Erik Moström wrote:

> I was playing with appscript and created a script and
everything  
> worked just
> fine when I ran it from within BBEdit. Then I moved it
to its  
> proper place
> and tried to use it from the command line, didn't
work, it didn't  
> understand
> the "import" command (unknown command).
>
> I started to cut down on the code and ended up with
> ---------------------------------
> #!/usr/local/bin/pythonw
>
> print 'hello world'
> ---------------------------------
>
>> ./test.py
> ./test.py: line 3: print: command not found

You need to upgrade to Universal Python, or use /usr/bin/env
in your  
#! line.

-bob

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
I don't understand
user name
2006-05-06 19:57:41
Bob Ippolito <bobredivi.com> 2006-05-06 21:53:

> You need to upgrade to Universal Python, or use
/usr/bin/env in your  
> #! line.

I mean the search path seems OK etc

            jem
-- 
Jan Erik Moström, www.mostrom.pp.se
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
I don't understand
user name
2006-05-06 19:57:14
Bob Ippolito <bobredivi.com> 2006-05-06 21:53:

> You need to upgrade to Universal Python, or use
/usr/bin/env in your  
> #! line.

Yep, that seems to work. Can you explain why?

                    jem
-- 
Jan Erik Moström, www.mostrom.pp.se
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
I don't understand
user name
2006-05-06 22:07:00
On May 6, 2006, at 12:57 PM, Jan Erik Moström wrote:

> Bob Ippolito <bobredivi.com> 2006-05-06
21:53:
>
>> You need to upgrade to Universal Python, or use
/usr/bin/env in your
>> #! line.
>
> Yep, that seems to work. Can you explain why?

Universal Python replaces pythonw (and python) with a small 

executable that does what the old pythonw used to (execve a
python  
interpreter that lives inside of an application bundle).
That means  
pythonw is irrelevant as of Universal Python, because either
way you  
start it you'll be able to run GUI stuff.

The reason you can't use the old pythonw in a #! line is
because it's  
a shell script and for whatever reason you can't use a
shell script  
as the target for a #! line in Mac OS X.

-bob

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )