D
DLitgo
Hello everyone,
I have a curious problem which I'm wondering if anyone here can shed
some light on. I'm basically just following along with a guide which
is going through some of the os module, and I'm running some examples
in the python interpreter on mac os x (accessed through terminal/
bash).
Basically all I did was use os.fork() which caused this strange
problem:
Macintosh:~ $ python
Python 2.5.1 (r251:54863, Jan 13 2009, 10:26:13)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.Traceback (most recent call last):
File "<stdin>", line 1
pdpit'htth l'?
^
SyntaxError: invalid syntax File "<stdin>", line 1
ex)
^
SyntaxError: invalid syntax
File "<stdin>", line 1
rn wa ehe'it(
^
SyntaxError: invalid syntaxMacintosh:~ $
Sorry for any formatting issues with the above code/output, I don't
post on these mailing lists often and I usually just do it through
groups.google.com in my browser.
But as you can see something strange happens and things just get
garbled and unusual. I restarted bash to see if that was the issue (it
isn't) and I've also restarted my computer since I noticed this
happening (earlier today) and nothing different happens when I import
and use os.fork().
I did however enter these simple lines into an empty file and ran it
from bash which ended up going just fine:
#file: test.py
import os
pid = os.fork()
if pid == 0: os.execvp("ls", ["ls", "-l"])
I have a curious problem which I'm wondering if anyone here can shed
some light on. I'm basically just following along with a guide which
is going through some of the os module, and I'm running some examples
in the python interpreter on mac os x (accessed through terminal/
bash).
Basically all I did was use os.fork() which caused this strange
problem:
Macintosh:~ $ python
Python 2.5.1 (r251:54863, Jan 13 2009, 10:26:13)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.Traceback (most recent call last):
File "<stdin>", line 1
pdpit'htth l'?
^
SyntaxError: invalid syntax File "<stdin>", line 1
ex)
^
SyntaxError: invalid syntax
File "<stdin>", line 1
rn wa ehe'it(
^
SyntaxError: invalid syntaxMacintosh:~ $
Sorry for any formatting issues with the above code/output, I don't
post on these mailing lists often and I usually just do it through
groups.google.com in my browser.
But as you can see something strange happens and things just get
garbled and unusual. I restarted bash to see if that was the issue (it
isn't) and I've also restarted my computer since I noticed this
happening (earlier today) and nothing different happens when I import
and use os.fork().
I did however enter these simple lines into an empty file and ran it
from bash which ended up going just fine:
#file: test.py
import os
pid = os.fork()
if pid == 0: os.execvp("ls", ["ls", "-l"])