Home > front end >  ModuleNotFoundError: No module named 'pytop'
ModuleNotFoundError: No module named 'pytop'

Time:01-09

I have installed pyotp but still I am getting below error

C:\Users\PANKAJ\AppData\Local\Programs\Python\Python310\python.exe C:\Users\PANKAJ\PycharmProjects\pythonProject2\L1.py Traceback (most recent call last): File "C:\Users\PANKAJ\PycharmProjects\pythonProject2\L1.py", line 1, in import pytop ModuleNotFoundError: No module named 'pytop'

My code is

import pytop
from NorenRestApiPy.NorenApi import  NorenApi

class ShoonyaApiPy(NorenApi):
    def __init__(self):
        NorenApi.__init__(self, host='https://api.shoonya.com/NorenWClientTP/', websocket='wss://api.shoonya.com/NorenWSTP/')
        global api
        api = self

import logging
import pyotp

#enable dbug to see request and responsesŚŚŚḌŚŚŚ
logging.basicConfig(level=logging.DEBUG)

#start of our program
api = ShoonyaApiPy()

#credentials
token = 'XX'
otp = pyotp.TOTP(token).now()

user        = 'XX'
u_pwd       = 'Purav@84'
factor2     = otp
vc          = 'XX_U'
app_key     = 'XX'
imei        = 'test12345'

ret = api.login(userid=user, password=u_pwd, twoFA=otp, vendor_code=vc, api_secret=app_key, imei=imei)
print(ret)

#

What can be solution for this?

CodePudding user response:

There seems to be an error in the import statement. The module being imported is called "pyotp", however, the statement reads "pytop". Please correct this by replacing "pytop" with "pyotp" in the import statement

CodePudding user response:

pyotp is a third party package not included in the Python standard library. Have you installed it by running pip install pyotp?

  • Related