Error confusing a newbie

Wayne Topa wtopa at dmcom.net
Sat Dec 11 16:19:18 EST 1999


	Subject: Re: Error confusing a newbie
	Date: Sat, Dec 11, 1999 at 08:08:22PM +0100

In reply to:Bernhard Herzog

Quoting Bernhard Herzog(herzog at online.de):
>| 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?
>| 

Give that man a Big Box of cigars.  

No, as a matter of fact, I had 'not' noticed.  As soon as I deleted the 
first blank line it worked!  If you hadn't mentioned it I would not have 
found that.  Line 7 was line 7 in vim and I let vim to do the counting. 
Darn, was that stupid of me!!

Well I hope to never get burned by 'that' again.  Many, many thanks to
all who tried to find 'my' mistake.  

Bernhard, where do I send the cigars?  Thank you!!!

Tschuess

Wayne

-- 
Our OS who art in CPU, UNIX be thy name.
        Thy programs run, thy syscalls done,
        In kernel as it is in user!
_______________________________________________________




More information about the Python-list mailing list