Reading long lines doesn't work in Python

2006-07-19 Thread Scott Simpson
I have a loop

for line in f:
 ...

and if the line is over about 10,000 characters it lops it off. How do I 
get around this?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading long lines doesn't work in Python

2006-07-19 Thread Scott Simpson
Sorry, found the bug somewhere else. You're right. Python is working OK.

-- 
http://mail.python.org/mailman/listinfo/python-list


How to import whole namespace into global symbol table? (newbie)

2006-04-27 Thread Scott Simpson
Suppose I have the following python program:

def func():
 from sys import stderr, exit
 try:
 f = open("foo", 'r')
 except IOError:
 print >> stderr, "Input file foo does not exist"
 exit(1)

def main():
 import sys

 if len(args) != 0:
 sys.exit(1)

 func()

if __name__ == '__main__':
 main()

Notice that I have two "import sys" statements, one for each function. 
Is there any way to import the "sys" stuff to the global symbol table so 
I don't need two "import" statements?

Lastly, is there an equivalent of Perl's "die" function? I'm writing to 
stderr and dieing above but I'm not quite sure if this is the "correct" way.
-- 
http://mail.python.org/mailman/listinfo/python-list