Error confusing a newbie

Bernhard Herzog herzog at online.de
Sat Dec 11 14:08:22 EST 1999


Wayne Topa <wtopa at dmcom.net> writes:

[...]
> 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')'
> 
> Here is the script
> ---------------------------------------------
> #!/usr/bin/env python
> 
> import string,sys
> from DateTime import *
> 
> input = open('/var/log/totalppp', 'r')
> times=input.readlines()
> input.close()
[snip rest of script]

Did you notice that the line numbers are off by one? The open is on line
6 and not seven. Perhaps your file starts with a newline?


-- 
Bernhard Herzog	  | Sketch, a drawing program for Unix
herzog at online.de  | http://www.online.de/home/sketch/



More information about the Python-list mailing list