I have a paid account. I am trying to connect to the mySQL database with the following details: Using sshtunnel version 0.4.0 mysql-connector version 2.2.9 ===================================================================================== import sshtunnel import mysql.connector import logging import datetime import myhelpers
logging.basicConfig() logger = logging.getLogger(name) logger.setLevel(logging.DEBUG) sshtunnel.SSH_TIMEOUT = 5.0 sshtunnel.TUNNEL_TIMEOUT = 5.0
with sshtunnel.SSHTunnelForwarder( ('ssh.pythonanywhere.com'), ssh_username='arguptaHello', ssh_password='****', remote_bind_address=('arguptaHello.mysql.pythonanywhere-services.com', 3306), logger=logger) as tunnel:
dbConnection = mysql.connector.connect(
user='arguptaHello', password='*****',
host='127.0.0.1', port=tunnel.local_bind_port,
database='arguptaHello$default',
)
print("Starting to do stuff....", flush=True)
df.to_sql("cbuzzjsonsched",dbConnection,if_exists='replace',index = False)
================================================================================
results in the following error : WARNING:main:Could not read SSH configuration file: ~/ssh\config INFO:main:0 keys loaded from agent INFO:main:0 keys loaded from host directory INFO:main:Connecting to gateway: ssh.pythonanywhere.com:22 as user 'arguptaHello' DEBUG:main:Concurrent connections allowed: True DEBUG:main:Trying to log in with password: * DEBUG:main:Authentication error WARNING:main:Tunnels are not started. Please .start() first! DEBUG:main:Transport is closed ERROR:main:Could not open connection to gateway Traceback (most recent call last): File "c:\python374\lib\site-packages\thonny\backend.py", line 1744, in trace return self._trace_and_catch(frame, event, arg) File "c:\python374\lib\site-packages\thonny\backend.py", line 1819, in _trace_and_catch assert last_custom_frame.event.startswith("before") AssertionError Traceback (most recent call last): File "c:\python374\lib\site-packages\thonny\backend.py", line 1213, in wrapper result = method(self, *args, kwargs) File "c:\python374\lib\site-packages\thonny\backend.py", line 1200, in wrapper return method(self, args, *kwargs) File "c:\python374\lib\site-packages\thonny\backend.py", line 1272, in _execute_prepared_user_code exec(statements, global_vars) File "C:\alok\tunnelOut.py", line 25, in <module> logger=logger) as tunnel: File "C:\Users\Divyanshu Gupta\AppData\Roaming\Python\Python37\site-packages\sshtunnel.py", line 1552, in enter self.start() File "C:\Users\Divyanshu Gupta\AppData\Roaming\Python\Python37\site-packages\sshtunnel.py", line 1294, in start reason='Could not establish session to SSH gateway') File "C:\Users\Divyanshu Gupta\AppData\Roaming\Python\Python37\site-packages\sshtunnel.py", line 1100, in _raise raise exception(reason) sshtunnel.BaseSSHTunnelForwarderError: Could not establish session to SSH gateway
Where am I going wrong.
Regards