[issue12867] linecache.getline() Returning Error

2011-08-31 Thread Ned Deily

Ned Deily n...@acm.org added the comment:

The linecache module functions take a filename string as an argument, not a 
file object.  Try:

   linecache.getlines(/path/to/filename, lineno)

http://docs.python.org/py3k/library/linecache.html

--
nosy: +ned.deily
resolution:  - works for me
stage:  - committed/rejected
status: open - closed
type: crash - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12867
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12867] linecache.getline() Returning Error

2011-08-30 Thread Jordan Meyer

New submission from Jordan Meyer jordanmeyer1...@gmail.com:

In trying to use the linecache.getline() function to extra data from a 
plain-text database format that I'm building. Every time I make a call to it 
(even from the interpreter directly) I get an error like the one below. I 
believe the problem lies in the linecache module itself.

Traceback (most recent call last):
  File 
/Users/jordanmeyer/Documents/Python/eFlashcard/alpha/0.1a2/eFlashcard_0.1a2.py,
 line 59, in module
eFlashcard_main()
  File 
/Users/jordanmeyer/Documents/Python/eFlashcard/alpha/0.1a2/eFlashcard_0.1a2.py,
 line 17, in eFlashcard_main
eFlashcard_build()
  File 
/Users/jordanmeyer/Documents/Python/eFlashcard/alpha/0.1a2/eFlashcard_0.1a2.py,
 line 31, in eFlashcard_build
while str(linecache.getline(lib_file, lib_index, module_globals=None)) != 
'':
  File 
/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/linecache.py, 
line 15, in getline
lines = getlines(filename, module_globals)
  File 
/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/linecache.py, 
line 41, in getlines
return updatecache(filename, module_globals)
  File 
/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/linecache.py, 
line 76, in updatecache
if not filename or (filename.startswith('') and filename.endswith('')):
AttributeError: '_io.TextIOWrapper' object has no attribute 'startswith'

--
components: Library (Lib)
messages: 143247
nosy: Jordan.Meyer
priority: normal
severity: normal
status: open
title: linecache.getline() Returning Error
type: crash
versions: Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12867
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com