Python app using Requests has missing files and errors after cx_freeze -
edit:
so ended using portable python. goal run python script on windows server doesn't have python installed, , that's pp can do. not solution original question, if else runs in same issue that's 1 way solve it.
i've built python program uses requests library. works fine when run normally, not after freezing executable cx_freeze.
i've looked @ , tried answers these questions:
requests library | frozen app | requests & cx_freeze
so neither adding:
import requests.certs build_exe_options = {"include_files" : [(requests.certs.where(),'cacert.pem')]}
nor
os.environ["requests_ca_bundle"] = os.path.join(os.getcwd(), "cacert.pem")
are working me.
my request looks this:
def get_response(id = constant_id, token = constant_token, page = none): url = 'https://scm.commerceinterface.com/api/v2/get_orders' return requests.get(url, params = {'supplier_id':id, 'token':token, 'page':page }).json()
so i'm not passing verify = parameter , works python program...
here error(s) returned when run executable:
file "c:\python34\lib\site packages\requests\packages\urllib3\util\ssl_.py", line 267, in ssl_wrap_socket context.load_verify_locations(ca_certs) filenotfounderror: [errno 2] no such file or directory during handling of above exception, exception occurred: traceback (most recent call last): file "c:\python34\lib\site-packages\requests\adapters.py", line 370, in send timeout=timeout file "c:\python34\lib\site packages\requests\packages\urllib3\connectionpool.p y", line 539, in urlopen self._prepare_proxy(conn) file "c:\python34\lib\site- packages\requests\packages\urllib3\connectionpool.p y", line 727, in _prepare_proxy conn.connect() file "c:\python34\lib\site- packages\requests\packages\urllib3\connection.py", line 238, in connect ssl_version=resolved_ssl_version) file "c:\python34\lib\site-packages\requests\packages\urllib3\util\ssl_.py", line 269, in ssl_wrap_socket raise sslerror(e) requests.packages.urllib3.exceptions.sslerror: [errno 2] no such file or directory during handling of above exception, exception occurred: traceback (most recent call last): file "c:\python34\lib\site-packages\cx_freeze\initscripts\console.py", line 27, in <module> exec(code, m.__dict__) file "main.py", line 49, in <module> file "main.py", line 18, in get_response file "c:\python34\lib\site-packages\requests\api.py", line 69, in return request('get', url, params=params, **kwargs) file "c:\python34\lib\site-packages\requests\api.py", line 50, in request response = session.request(method=method, url=url, **kwargs) file "c:\python34\lib\site-packages\requests\sessions.py", line 465, in request resp = self.send(prep, **send_kwargs) file "c:\python34\lib\site-packages\requests\sessions.py", line 573, in send r = adapter.send(request, **kwargs) file "c:\python34\lib\site-packages\requests\adapters.py", line 431, in send raise sslerror(e, request=request) requests.exceptions.sslerror: [errno 2] no such file or directory
Comments
Post a Comment