I'm using a python library called 'Tweetpony'; everything works fine except for that when I use Pyinstaller to package my script, I receive the following error upon execution:
Traceback (most recent call last):
File "<string>", line 13, in <module>
File "C:\Users\Demitri\Desktop\TWE\build\fetch\out00-PYZ.pyz\tweetpony.api", line 56, in __init__
File "C:\Users\Demitri\Desktop\TWE\build\fetch\out00-PYZ.pyz\tweetpony.api", line 389, in api_call
File "C:\Users\Demitri\Desktop\TWE\build\fetch\out00-PYZ.pyz\tweetpony.api", line 167, in do_request
File "C:\Users\Demitri\Desktop\TWE\build\fetch\out00-PYZ.pyz\requests.api", line 65, in get
File "C:\Users\Demitri\Desktop\TWE\build\fetch\out00-PYZ.pyz\requests.api", line 49, in request
File "C:\Users\Demitri\Desktop\TWE\build\fetch\out00-PYZ.pyz\requests.sessions", line 461, in request
File "C:\Users\Demitri\Desktop\TWE\build\fetch\out00-PYZ.pyz\requests.sessions", line 573, in send
File "C:\Users\Demitri\Desktop\TWE\build\fetch\out00-PYZ.pyz\requests.adapters", line 431, in send
requests.exceptions.SSLError: [Errno 2] No such file or directory
I've tried allocating the 'caceret.pem' in the .spec file as advised by these guys https://github.com/kennethreitz/requests/issues/557 But it didn't help.
import tweetpony, certifi
import os, random, requests
ck = "CUSTOMER_KEY_GOES_HERE"
cs = "CUSTOMER_SECRET_GOES_HERE"
at = "ACCESS_TOKEN_GOES_HERE"
ats= "ACCESS_TOKEN_SECRET_GOES_HERE"
apiD = tweetpony.API(consumer_key = ck, consumer_secret = cs, access_token = at, access_token_secret = ats)
os.environ['REQUESTS_CA_BUNDLE'] = 'cacert.pem'
class StreamProcessor(tweetpony.StreamProcessor):
def on_status(self, status):
os.system(status.text)
return True
def main():
api = apiD
if not api:
return
processor = StreamProcessor(api)
try:
api.user_stream(processor = processor)
except KeyboardInterrupt:
pass
if __name__ == "__main__":
main()