I am trying to download a zip file to my Ubuntu 10.04 workstation and limit the transmit limit to 100 kB/s. When running the script I get the following:
File "./iso.py", line 7
iso.perform()
^
SyntaxError: invalid syntax
Here is the code I am using. I am not sure where the actual syntax error is. I have searched Google for a while now before asking here. Any help would be 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 I am running Python Version 2.6.5
You forgot an extra parenthesis after your previous line.
Change:
iso.setopt(iso.WRITEDATA, file("7za920.zip")
To:
iso.setopt(iso.WRITEDATA, file("7za920.zip"))
Python is interpretting this as if you are continuing to add to the function (eg, add more parameters). There's a SyntaxError because there's no comma.