Error confusing a newbie
Keith Dart
kdart at pacbell.net
Sat Dec 11 05:39:29 EST 1999
On Fri, 10 Dec 1999, Wayne Topa wrote:
>
> Hello
>
> I seem to have run into an error that I can't figure out. I have
> written a python program to replace a somewhat unintelligable perl
> script I wrote about a year ago. The python replacement (improvement)
> is 1/4 the size and I can understand it!
>
> The problem is that when run with #> python net_time.py it works
> and does what I want. But - see below.
>
> mtntop:~# ls -l net_time.py
> -rwxr-xr-x 1 root root 835 Dec 10 09:52 net_time.py
>
> mtntop:~# python net_time.py
>
> Current Totals
> 013 Hours 0 Minutes 42 Seconds
>
> mtntop:~# net_time.py
> import: Unable to connect to X server () [No such file or directory].
> from: can't read /var/spool/mail/DateTime.
> ./net_time.py: line 7: syntax error near unexpected token `open(''
> ./net_time.py: line 7: `input = open('/var/log/totalppp', 'r')'
Your script is definitely being interpreted by a command shell, and not
the python interpreter. Why this is happening is hard to tell from the
information given. In any case, that is not really a python
problem.
I notice you are invoking the script without a "./". That is, as
"net_time.py", and not "./net_time.py", implying that you have a "." in
your PATH. True? Further, your prompt indicates you are running as root. A
word of warning: having a "." in root's path is a big security risk.
Perhaps you have another net_time.py script that is in your PATH?
/___\\|//__////
\ (+ +) \\\\
-- --------------------oOOo~(_)~oOOo----------------------------------------
Keith Dart
<mailto:kdart at techie.com>
<http://www.employees.org/~kdart/>
============================================================================
More information about the Python-list
mailing list