Hi,
I have created TY.py. The Ty.py file executes and runs successfully.
I am trying to make its executable using py2exe and by creating setup.py.
It is not able to include the requests. I think it is because 'requests' is not present in 'include' folder for python27. The path of the requests library is at C:\Python27\Lib\site-packages\requests. I do not know where and how I should tell my setup.py about requests.
Setup.py
from distutils.core import setup
import py2exe
setup(
console=['Ty.py'],
options={
'py2exe': {'includes': ['lxml.html', 'lxml._elementpath', 'lxml.etree','gzip','requests']},
}
)
Ty.py
import requests, lxml.html,csv
si = requests.Session()
response = si.post("https://www.lacrossealerts.com/login/", data={'username': 'name123', 'password': 'password123'})
response = si.get("http://www.lacrossealerts.com/v1/observations/?serial=%s&format=csv&from=%ddays" % ("098117CF1EF2E338", -40))
#print response.text
data=response.text
with open("server_room.csv", 'wb') as fd:
for chunk in response.iter_content(2024):
fd.write(chunk)
I get the following error while trying to run the executable created through setup.py.
C:\Users\hbil\Desktop\dist>temp1.exe
Traceback (most recent call last):
File "Temp1.py", line 4, in <module>
File "requests\sessions.pyc", line 504, in post
File "requests\sessions.pyc", line 461, in request
File "requests\sessions.pyc", line 573, in send
File "requests\adapters.pyc", line 431, in send
requests.exceptions.SSLError: [Errno 2] No such file or directory