commandcommand-promptbinancebinance-api-clientpython-binance

I try to run my Python code in Command Prompt but it doesn't work


I just wrote a few lines of code to get data from Binance (I'm just using the Testnet API).

My code runs fine on Jupyter Notebook.

But when I try to run the code in Command Prompt (or Anaconda Prompt), it doesn't work.

It seems like the code still runs without any errors but it is not getting data back from the API.

===

  • My code:

    from binance.client import Client

    import pandas as pd

    import asyncio from binance import AsyncClient, BinanceSocketManager

    from datetime import datetime, timedelta

    client = Client(api_key = "...my Testnet api_key...", api_secret = "...my Testnet api_secret", tld = "com", testnet=True)

    print("Hello..........")

    client.get_account()

    print("Hello......123....")

===

How can I fix this situation? Thank you so much! P/s: I'm using python-binance package 1.0.19

===

I tried running on Anaconda Prompt but couldn't get the data back so I connected Command Prompt to Anaconda Prompt via Activate. But still not working.


Solution

  • Terminals or Command Prompts usually don't behave like Jupyter Notebook and show data/logs unless you explicitly print it, however from what i see maybe try the following

    print(client.get_account())