Error confusing a newbie
M.-A. Lemburg
mal at lemburg.com
Fri Dec 10 12:14:18 EST 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 shell is obviously trying to execute the script as-is
instead of calling Python to do the job. One possible explanation
for this is that there is no /usr/bin/env command installed
on your machine (could be in /bin though).
Note that 'import' is a tool to capture screen content and
write it to a file.
> Here is the script
> ---------------------------------------------
> #!/usr/bin/env python
>
> import string,sys
> from DateTime import *
> ...
Hope that helps,
--
Marc-Andre Lemburg
______________________________________________________________________
Y2000: 21 days left
Business: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/
More information about the Python-list
mailing list