Parsing a search string
Reinhold Birkenfeld
reinhold-birkenfeld-nospam at wolke7.net
Fri Dec 31 11:24:32 EST 2004
M.E.Farmer wrote:
> As I noted before shlex requires a file like object or a open file .
> py> import shlex
> py> a = shlex.shlex('fgfgfg dgfgfdgfdg')
> py> a.get_token()
> Traceback (most recent call last):
> File "<input>", line 1, in ?
> File ".\shlex.py", line 74, in get_token
> raw = self.read_token()
> File ".\shlex.py", line 100, in read_token
> nextchar = self.instream.read(1)
> AttributeError: 'str' object has no attribute 'read'
Which Python version are you using?
The docs say that since Py2.3 strings are accepted.
regards,
Reinhold
More information about the Python-list
mailing list