Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configparser.NoSectionError: No section: 'main' #19

Closed
tifoji opened this issue Jun 18, 2022 · 2 comments
Closed

configparser.NoSectionError: No section: 'main' #19

tifoji opened this issue Jun 18, 2022 · 2 comments

Comments

@tifoji
Copy link

tifoji commented Jun 18, 2022

I cannot get the web page authentication to pop up when I try to run td.client.py in VS Code. There is no error after the python interpreter calls the script, just returns to the terminal.

Python 3.9.12

pi@raspberrypi:~/tos/td-ameritrade-api $ /usr/bin/python /home/pi/tos/td-ameritrade-api/td/client.py
pi@raspberrypi:~/tos/td-ameritrade-api $ 

All tests subsequently fail but pasting here in case this puts more context around the errors.

pi@raspberrypi:~/tos/td-ameritrade-api $ /usr/bin/python /home/pi/tos/td-ameritrade-api/tests/test_client.py
EEEEEEEEEEEE
======================================================================
ERROR: test_creates_instance_of_accounts (__main__.TestTdClient)
Create an instance and make sure it's a `Accounts` object.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pi/tos/td-ameritrade-api/tests/test_client.py", line 34, in setUp
    client_id = config.get('main', 'client_id')
  File "/usr/local/lib/python3.9/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "/usr/local/lib/python3.9/configparser.py", line 1152, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'main'

======================================================================
ERROR: test_creates_instance_of_client (__main__.TestTdClient)
Create an instance and make sure it's a `TdAmeritradeClient` object.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pi/tos/td-ameritrade-api/tests/test_client.py", line 34, in setUp
    client_id = config.get('main', 'client_id')
  File "/usr/local/lib/python3.9/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "/usr/local/lib/python3.9/configparser.py", line 1152, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'main'

======================================================================
ERROR: test_creates_instance_of_instruments (__main__.TestTdClient)
Create an instance and make sure it's a `Instruments` object.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pi/tos/td-ameritrade-api/tests/test_client.py", line 34, in setUp
    client_id = config.get('main', 'client_id')
  File "/usr/local/lib/python3.9/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "/usr/local/lib/python3.9/configparser.py", line 1152, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'main'

======================================================================
ERROR: test_creates_instance_of_market_hours (__main__.TestTdClient)
Create an instance and make sure it's a `MarketHours` object.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pi/tos/td-ameritrade-api/tests/test_client.py", line 34, in setUp
    client_id = config.get('main', 'client_id')
  File "/usr/local/lib/python3.9/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "/usr/local/lib/python3.9/configparser.py", line 1152, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'main'

======================================================================
ERROR: test_creates_instance_of_mover (__main__.TestTdClient)
Create an instance and make sure it's a `Movers` object.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pi/tos/td-ameritrade-api/tests/test_client.py", line 34, in setUp
    client_id = config.get('main', 'client_id')
  File "/usr/local/lib/python3.9/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "/usr/local/lib/python3.9/configparser.py", line 1152, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'main'

======================================================================
ERROR: test_creates_instance_of_options_chain (__main__.TestTdClient)
Create an instance and make sure it's a `OptionsChain` object.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pi/tos/td-ameritrade-api/tests/test_client.py", line 34, in setUp
    client_id = config.get('main', 'client_id')
  File "/usr/local/lib/python3.9/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "/usr/local/lib/python3.9/configparser.py", line 1152, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'main'

======================================================================
ERROR: test_creates_instance_of_orders (__main__.TestTdClient)
Create an instance and make sure it's a `Orders` object.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pi/tos/td-ameritrade-api/tests/test_client.py", line 34, in setUp
    client_id = config.get('main', 'client_id')
  File "/usr/local/lib/python3.9/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "/usr/local/lib/python3.9/configparser.py", line 1152, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'main'

======================================================================
ERROR: test_creates_instance_of_price_history (__main__.TestTdClient)
Create an instance and make sure it's a `PriceHistory` object.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pi/tos/td-ameritrade-api/tests/test_client.py", line 34, in setUp
    client_id = config.get('main', 'client_id')
  File "/usr/local/lib/python3.9/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "/usr/local/lib/python3.9/configparser.py", line 1152, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'main'

======================================================================
ERROR: test_creates_instance_of_quote (__main__.TestTdClient)
Create an instance and make sure it's a `Quotes` object.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pi/tos/td-ameritrade-api/tests/test_client.py", line 34, in setUp
    client_id = config.get('main', 'client_id')
  File "/usr/local/lib/python3.9/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "/usr/local/lib/python3.9/configparser.py", line 1152, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'main'

======================================================================
ERROR: test_creates_instance_of_saved_orders (__main__.TestTdClient)
Create an instance and make sure it's a `SavedOrders` object.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pi/tos/td-ameritrade-api/tests/test_client.py", line 34, in setUp
    client_id = config.get('main', 'client_id')
  File "/usr/local/lib/python3.9/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "/usr/local/lib/python3.9/configparser.py", line 1152, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'main'

======================================================================
ERROR: test_creates_instance_of_user_info (__main__.TestTdClient)
Create an instance and make sure it's a `UserInfo` object.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pi/tos/td-ameritrade-api/tests/test_client.py", line 34, in setUp
    client_id = config.get('main', 'client_id')
  File "/usr/local/lib/python3.9/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "/usr/local/lib/python3.9/configparser.py", line 1152, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'main'

======================================================================
ERROR: test_creates_instance_of_watchlists (__main__.TestTdClient)
Create an instance and make sure it's a `Watchlists` object.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pi/tos/td-ameritrade-api/tests/test_client.py", line 34, in setUp
    client_id = config.get('main', 'client_id')
  File "/usr/local/lib/python3.9/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "/usr/local/lib/python3.9/configparser.py", line 1152, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'main'

----------------------------------------------------------------------
Ran 12 tests in 0.024s

FAILED (errors=12)
pi@raspberrypi:~/tos/td-ameritrade-api $ 
@BillSchumacher
Copy link

You need to add a config.ini file with a main section like so:
image

@tifoji
Copy link
Author

tifoji commented Jul 4, 2022

Thanks @BillSchumacher . I think a lot of the user base migrated from the older python-api project and were already familiar with the config/config.ini requirement. But I think having this as part of the wiki for td-api will be helpful for newcomers. Thanks a lot for the project, only getting started with it.

I am closing it as the resolution has been posted here for the issue. Thanks again.

@tifoji tifoji closed this as completed Jul 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants