(no subject)

Patrick.Bussi at space.alcatel.fr Patrick.Bussi at space.alcatel.fr
Tue Jan 2 06:55:31 EST 2001


Hello. Happy new Year.

Basically, my need is to use the "seek" method on data retrieved from an URL.
The Python Reference Manual indicates that this method cannot be used directly
after opening the URL with urllib. Therefore I (unsuccessfully) tried other
ways.

---- First, I tried the extended form of the "print" statement, after carefully
reading the 6.6 of Python Reference Manual.

The interpreter replied the following :

    print >> indexpage, f1.read
             ^
SyntaxError: invalid syntax

where :
"indexpage" was a "true" file opened with "w" parameter, before the occurrence
of this statement,
"f1" was the network object obtained by the urllib.urlopen() function.

---- Second, I tried to use :

"urllib.urlretrieve()", which do NOT seem to accept any optional argument after
the hook argument, although 11.3 of Python Library Reference explains it should
accept.

---- Third, I used :

"urllib._urlopener.retrieve" object, which accepts optional data. But my data is
a dictionnary and the interpreter seems to consider that he gets too many
arguments (typically 5 instead of the 4 expected, when my data set is composed
of 2 : {'tag1':value1,'tag2':value2} )

---- Fourth :

pickle does not work onto Network object :-(

May be I am far from understanding something basic. I apologize in this case.
Of course I could try to avoid use of "seek" method, but I would have to rewrite
a function that works well on "ordinary" files.

Thankyou for any help.

Patrick Bussi  -- very recent Pythonist
-------------------------------------------------------








More information about the Python-list mailing list