I'm trying to use pycurl on the Raspberry Pi. I've successfully installed pycurl using apt-get install python-pycurl
and I've found a little script to use to see if it's working correctly:
import pycurl
c = pycurl.Curl()
c.setopt(c.URL, 'http://news.ycombinator.com')
c.perform()
When I run this script using sudo ./pycurltest.py
I get an error:
./pycurltest.py: 1: ./pycurltest.py: import: not found
./pycurltest.py: 2: ./pycurltest.py: Syntax error: "(" unexpected
However, if use the python interpreter and use help(modules)
I can see that pycurl is installed. When I try to run the same script in the interpreter it works and I get:
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>
What am I missing here?