Error message "Object has no attribute message" while placing order

Strategist
Strategist edited April 2023 in API clients
I have updated kiteconnect latest version after that facing this error while placing order.
Tagged:
  • tonystark
    Could you post a minimal example code that can reproduce your problem at our end?

    Make sure to remove all account credentials from the code before posting.
  • Strategist
    Hello Tonystark,
    executing code is posted below, please look into it

    code=NIFTY2340617500PE
    def orderAsPutSeller(code):


    orderPlaced = False
    print(code,kite.VARIETY_REGULAR,kite.EXCHANGE_NFO,kite.TRANSACTION_TYPE_SELL,Quantity,kite.PRODUCT_MIS,kite.ORDER_TYPE_MARKET)

    while(orderPlaced == False):

    try:

    order_id = kite.place_order(tradingsymbol=code,
    variety=kite.VARIETY_REGULAR,
    exchange=kite.EXCHANGE_NFO,
    transaction_type=kite.TRANSACTION_TYPE_SELL,
    quantity= str(Quantity),
    order_type= kite.ORDER_TYPE_MARKET,
    product=kite.PRODUCT_MIS,price=None, validity=None,
    disclosed_quantity=None, trigger_price=None,
    squareoff=None, stoploss=None, trailing_stoploss=None, tag=None)

    print(order_id)
    orderPlaced = True
    orderList[0] = code
    total_orders.append(order_id)
    # print(datetime.datetime.now,"Put sell order placed")

    except Exception as e:

    print("Exception Occured while placing order as Put seller",e.message)
  • tonystark
    print("Exception Occured while placing order as Put seller",e.message)
    The error message from the title is probably from this line. Exception might not have message attribute. To get the actual exception message try str(e)
  • Strategist
    The actual exception message is "got an unexpected keyword argument squareoff"
  • tonystark
    squareoff is a parameter of bracket orders which are discontinued. If you don't use a param, instead of setting to None, you can simply not provide it in the function call.
  • Strategist
    Got it.
    Thank you very much for timely inputs.
This discussion has been closed.