Invalid syntax on ".perform()" with Python -
i trying download zip file ubuntu 10.04 workstation , limit transmit limit 100 kb/s. when running script following:
file "./iso.py", line 7 iso.perform() ^ syntaxerror: invalid syntax
here code using. not sure actual syntax error is. have searched google while before asking here. appreciated.
#!/usr/bin/env python import pycurl iso = pycurl.curl() iso.setopt(iso.url, "http://downloads.sourceforge.net/sevenzip/7za920.zip") iso.setopt(iso.max_recv_speed_large, 100000) iso.setopt(iso.writedata, file("7za920.zip") iso.perform()
fyi running python version 2.6.5
you forgot parenthesis after previous line.
change:
iso.setopt(iso.writedata, file("7za920.zip")
to:
iso.setopt(iso.writedata, file("7za920.zip"))
python interpretting if continuing add function (eg, add more parameters). there's syntaxerror because there's no comma.
Comments
Post a Comment