ImportError: cannot import name 'urljoin'

harshtock
Hi,

I am facing this issue first time. When i'm trying to run a simple script, it's throwing this error while module initialization.

Traceback (most recent call last):
File "/kiteorders/kite-orders.py", line 1, in
from kiteconnect import KiteConnect
File "/kiteorders/kiteconnect/__init__.py", line 110, in
from kiteconnect.connect import KiteConnect
File "/kiteorders/kiteconnect/connect.py", line 11, in
from six.moves.urllib.parse import urljoin
ImportError: cannot import name 'urljoin'

Module initialization is simple as can be seen in stack trace:
from kiteconnect import KiteConnect

What could be the issue?
  • rakeshr
    ImportError: cannot import name 'urljoin'
    Can you try updating six package? Use pip install --upgrade six

    If still facing the issue, do let us know your kiteconnect version(pip show kiteconnect) and your python version(python --version)?
  • harshtock
    pip upgrade didn't work as i had already upgraded the whole kiteconnect via same command.
    $ python3 -m pip install --upgrade six
    Defaulting to user installation because normal site-packages is not writeable
    Requirement already satisfied: six in /home/ec2-user/.local/lib/python3.6/site-packages (1.15.0)
    kiteconnect version
    $ python3 -m pip show kiteconnect
    Name: kiteconnect
    Version: 3.9.0
    Summary: The official Python client for the Kite Connect trading API
    Home-page: https://kite.trade
    Author: Zerodha Technology Pvt ltd. (India)
    Author-email: [email protected]
    License: MIT
    Location: /home/ec2-user/.local/lib/python3.6/site-packages
    Requires: requests, six, pyOpenSSL, python-dateutil, service-identity, autobahn, enum34
    Required-by:
    python version
    $ python3 --version
    Python 3.6.0
  • harshtock
    it seems to be a problem related to the directory the script is in.

    Because i checked other scripts in other directories are working fine. So i copied the same script in another folder, and it's working fine.

    I 'll check and post again if i find something else related to this.
Sign In or Register to comment.