cannot import name 'SmartConnect' from partially initialized module 'smartapi'
-
I am new to Python and started using your api in python. Using following code by going through few videos on youtube and your codes.
from smartapi import SmartConnect #or from smartapi.smartConnect import SmartConnect
#import smartapi.smartExceptions(for smartExceptions)is generating error
PS C:\Users\DELL> & C:/Users/DELL/AppData/Local/Programs/Python/Python311/python.exe d:/Manish/Python/smartapi.py
Traceback (most recent call last):
File "d:\Manish\Python\smartapi.py", line 1, in <module>
from smartapi import SmartConnect #or from smartapi.smartConnect import SmartConnect
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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) (d:\Manish\Python\smartapi.py)
PS C:\Users\DELL> & C:/Users/DELL/AppData/Local/Programs/Python/Python311/python.exe d:/Manish/Python/smartapi.py
Traceback (most recent call last):
File "d:\Manish\Python\smartapi.py", line 5, in <module>
obj=SmartConnect(api_key="ig3amEvr")
^^^^^^^^^^^^
NameError: name 'SmartConnect' is not defined
PS C:\Users\DELL> & C:/Users/DELL/AppData/Local/Programs/Python/Python311/python.exe d:/Manish/Python/smartapi.py
Traceback (most recent call last):
File "d:\Manish\Python\smartapi.py", line 1, in <module>
from smartapi import SmartConnect #or from smartapi.smartConnect import SmartConnect
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "d:\Manish\Python\smartapi.py", line 1, 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) (d:\Manish\Python\smartapi.py)Please help.
My contact details are manishashar888@gmail.com / 9173605833 -
@Manish-Ashar i think u need to install packages 'smartapi-python' and
'websocket-client'pip install smartapi-python
pip install websocket-client - topic:timeago_earlier,2 months
-
@Manish-Ashar
Can you try by renaming your python file to something as "mySmartapi.py".
It should not be the same name as that from the repository! - topic:timeago_earlier,9 days
-
@Manish-Ashar Is it related to version of python?
-
@Manish-Ashar surprised that no body has time to reply or help me.