Forums

program runs locallyl but errors on Pythonanywhere

I am new with pythonanywhere. I have a program that runs fine locally with version 3.5.2 but not on pythonanywhere?

I have added the #!/usr/bin/python3.5 to the first line of the file and I can see that the correct interpreter is loaded when it starts.

The program is trying to connect to the SmartSheet API but I get the following error ... thanks for any help

  Traceback (most recent call last):
  File "Daily_planner_update.py", line 161, in <module>
my_sheet = ss_client.Sheets.get_sheet(SHEET_ID, page_size=5000)
  File "/home/resassured/.local/lib/python3.5/site-packages/smartsheet/sheets.py", line 515, in get_sheet
response = self._base.request(prepped_request, expected, _op)
  File "/home/resassured/.local/lib/python3.5/site-packages/smartsheet/smartsheet.py", line 242, in request
res = self.request_with_retry(prepped_request, operation)
  File "/home/resassured/.local/lib/python3.5/site-packages/smartsheet/smartsheet.py", line 333, in request_with_retry
    result = self._request(prepped_request, operation)
  File "/home/resassured/.local/lib/python3.5/site-packages/smartsheet/smartsheet.py", line 304, in _request
res = self._session.send(prepped_request, stream=stream)
  File "/usr/local/lib/python3.5/dist-packages/requests/sessions.py", line 585, in send
r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/requests/adapters.py", line 403, in send
timeout=timeout
  File "/usr/local/lib/python3.5/dist-packages/requests/packages/urllib3/connectionpool.py", line 566, in urlopen
    conn = self._get_conn(timeout=pool_timeout)
  File "/usr/local/lib/python3.5/dist-packages/requests/packages/urllib3/connectionpool.py", line 256, in _get_conn
    return conn or self._new_conn()
  File "/usr/local/lib/python3.5/dist-packages/requests/packages/urllib3/connectionpool.py", line 802, in _new_conn
strict=self.strict, **self.conn_kw)
  File "/usr/local/lib/python3.5/dist-packages/requests/packages/urllib3/connection.py", line 210, in __init__
timeout=timeout, **kw)
  File "/usr/local/lib/python3.5/dist-packages/requests/packages/urllib3/connection.py", line 126, in __init__
_HTTPConnection.__init__(self, *args, **kw)
TypeError: __init__() got an unexpected keyword argument 'ssl_context'

That's strange! How are you running it? From a console using "python3.5", or from the "run" button in the editor?

I have tried both console and from the run button. In my local environment I run it from PyCharm not a problem.

Can we take a look at your files? And if so, which file is it that's showing the problem?