Import error


  • PS C:\Users\hp\Desktop> & C:/Users/hp/AppData/Local/Programs/Python/Python39/python.exe "g:/Angel Broking/Smart API/Python/from smartapi import SmartConnect.py"
    Traceback (most recent call last):
    File "g:\Angel Broking\Smart API\Python\from smartapi import SmartConnect.py", line 1, in <module>
    from smartapi.smartConnect import SmartConnect
    File "g:\Angel Broking\Smart API\Python\smartapi.py", line 2, in <module>
    from smartapi import SmartConnect #or from smartapi.smartConnect import SmartConnect
    ImportError: cannot import name 'SmartConnect' from partially initialized module 'smartapi' (most likely due to a circular import) (g:\Angel Broking\Smart API\Python\smartapi.py)
    PS C:\Users\hp\Desktop> & C:/Users/hp/AppData/Local/Programs/Python/Python39/python.exe "g:/Angel Broking/Smart API/Python/from smartapi import SmartConnect.py"
    Traceback (most recent call last):
    File "g:\Angel Broking\Smart API\Python\from smartapi import SmartConnect.py", line 1, in <module>
    import smartapi.smartExceptions
    File "g:\Angel Broking\Smart API\Python\smartapi.py", line 2, in <module>
    from smartapi import SmartConnect #or from smartapi.smartConnect import SmartConnect
    ImportError: cannot import name 'SmartConnect' from partially initialized module 'smartapi' (most likely due to a circular import) (g:\Angel Broking\Smart API\Python\smartapi.py)
    PS C:\Users\hp\Desktop> & C:/Users/hp/AppData/Local/Programs/Python/Python39/python.exe "g:/Angel Broking/Smart API/Python/from smartapi import SmartConnect.py"
    Traceback (most recent call last):
    File "g:\Angel Broking\Smart API\Python\from smartapi import SmartConnect.py", line 1, in <module>
    from smartapi import SmartConnect
    File "g:\Angel Broking\Smart API\Python\smartapi.py", line 2, in <module>
    from smartapi import SmartConnect #or from smartapi.smartConnect import SmartConnect
    ImportError: cannot import name 'SmartConnect' from partially initialized module 'smartapi' (most likely due to a circular import) (g:\Angel Broking\Smart API\Python\smartapi.py)


  • Hi @aarohi you can go through some programming tutorials to understand how python works.


  • Hi @aarohi you have imported smartconnect and you have not used it so there is no error in this.



  • @admin runfile('C:/Users/AROHI/smartapi.py', wdir='C:/Users/AROHI')
    Traceback (most recent call last):

    File "C:\Users\AROHI\smartapi.py", line 7, in <module>
    from smartapi import SmartConnect

    File "C:\Users\AROHI\smartapi.py", line 7, in <module>
    from smartapi import SmartConnect

    ImportError: cannot import name 'SmartConnect' from 'smartapi' (C:\Users\AROHI\smartapi.py)

    debugfile('C:/Users/AROHI/smartapi.py', wdir='C:/Users/AROHI')

    c:\users\arohi\smartapi.py(6)<module>()
    3 Created on Fri May 28 21:00:30 2021
    4
    5 @author: AROHI
    ----> 6 """
    7 from smartapi import SmartConnect


  • Hi @aarohi We tested it from our end and we are able to get response from our end.You need to debug your issue from your end.


  • @admin problem still pertains


  • HI @aarohi kindly reinstall smartapi.