Dronekit : unable to connect. Link time out error

I’m trying to connect to the drone using a simple dronekit python script but I keep getting the error. I searched online for possible solutions but to no avail.

from dronekit import connect, VehicleMode, LocationGlobalRelative, APIException

from pymavlink import mavutil
import time
import socket
import exceptions
import argparse

def connectQuad():
        parser = argparse.ArgumentParser(description='Commands')
        args = parser.parse_args()
        connection_string= args.connect
        print 'Connecting to vehicle on: %s' % args.connect
        vehicle = connect(connection_string, wait_ready=True)
        return vehicle

vehicle = connectQuad()

pi@navio:~/drone-kit $ python connect_quad.py --connect
Connecting to vehicle on:
WARNING:dronekit:Link timeout, no heartbeat in last 5 seconds
ERROR:dronekit.mavlink:Exception in MAVLink input loop
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/dronekit/mavlink.py", line 211, in mavlink_thread_in
  File "/usr/local/lib/python2.7/dist-packages/dronekit/__init__.py", line 1371, in listener
APIException: No heartbeat in 30 seconds, aborting.
Traceback (most recent call last):
  File "connect_quad.py", line 18, in <module>
    vehicle = connectQuad()
  File "connect_quad.py", line 15, in connectQuad
    vehicle = connect(connection_string, wait_ready=True)
  File "/usr/local/lib/python2.7/dist-packages/dronekit/__init__.py", line 3166, in connect
    vehicle.initialize(rate=rate, heartbeat_timeout=heartbeat_timeout)
  File "/usr/local/lib/python2.7/dist-packages/dronekit/__init__.py", line 2275, in initialize
    raise APIException('Timeout in initializing connection.')
dronekit.APIException: Timeout in initializing connection.

Hi @novice,

May I ask you to describe your step-by-step actions that led to this issue? Have you tried using the IP address of your GCS instead?