question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Octopart.com TypeError: 'NoneType' object is not iterable

See original GitHub issue

Issue / Problem report

I’m trying to get “Octopart”, “LCSC”, and “RS Components” to populate. Every part of my Config.yaml is enabled, except Octopart, and appears to be working. Problems occur when I enable Octopart with either of the client values below.

   Octopart:
    # Octopart API Key
    key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    # API level: 3 or 4
    # level: 4
    # The extended API is for the Pro plan
    # extended: false
    # Only enabled if the key is defined
    enable: true
    # Directory for the APIs caches
    cache_path: ~/.cache/kicost/Octopart

I have my free Octopart Key installed, replaced below with xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. When I enable Octopart, this is what happens. I tried both “Client” values (ID and Secret) and the same thing happens with either: image

  1. C:\Users\craig\Desktop\555\KiCAD>kicost --version KiCost v1.1.11

  2. DEBUG:Distributors solved {‘tme’}, remaining {‘arrow’, ‘rs’, ‘lcsc’} (kicost.distributors - log.py:115) DEBUG:Considering: Octopart [‘arrow’, ‘digikey’, ‘farnell’, ‘lcsc’, ‘mouser’, ‘newark’, ‘rs’, ‘tme’] (kicost.distributors - log.py:115)

  • Octopart [api] (https://octopart.com/) DEBUG:# Getting part data from Octopart… (kicost.distributors - log.py:115) DEBUG:Queries 3 (kicost.distributors - log.py:115) DEBUG:Cached entries 0 (kicost.distributors - log.py:115) DEBUG:URL http://octopart.com/api/v4/rest/parts/match query: (kicost.distributors - log.py:115) DEBUG:queries=[{“reference”: “1”, “mpn”: “2N3906”}, {“reference”: “2”, “mpn”: “10K”}, {“reference”: “5”, “mpn”: “CA0555EX”}]&apikey=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (kicost.distributors - log.py:115) DEBUG:{ “errors”: [ { “message”: “No app for token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx not found” } ], “data”: null } (kicost.distributors - log.py:115) DEBUG:Status Code: <200> (kicost.distributors - log.py:115) Progress: 0%| | 0/3 [00:00<?, ?part/s]Traceback (most recent call last): File “C:\Program Files\KiCad\6.0\bin\Lib\runpy.py”, line 197, in run_module_as_main return run_code(code, main_globals, None, File “C:\Program Files\KiCad\6.0\bin\Lib\runpy.py”, line 87, in run_code exec(code, run_globals) File "C:\Program Files\KiCad\6.0\bin\Scripts\kicost.exe_main.py", line 7, in <module> File "C:\Program Files\KiCad\6.0\bin\Lib\site-packages\kicost_main.py", line 487, in main main_real() File "C:\Program Files\KiCad\6.0\bin\Lib\site-packages\kicost_main.py", line 477, in main_real kicost(in_file=args.input, eda_name=args.eda, File “C:\Program Files\KiCad\6.0\bin\Lib\site-packages\kicost\kicost.py”, line 251, in kicost query_part_info(parts, dist_list, currency) File “C:\Program Files\KiCad\6.0\bin\Lib\site-packages\kicost\kicost.py”, line 78, in query_part_info get_dist_parts_info(parts, dist_list, currency) File “C:\Program Files\KiCad\6.0\bin\Lib\site-packages\kicost\distributors_init_.py”, line 50, in get_dist_parts_info distributor_class.get_dist_parts_info(parts, dist_list, currency) File “C:\Program Files\KiCad\6.0\bin\Lib\site-packages\kicost\distributors\distributor.py”, line 144, in get_dist_parts_info solved = api.query_part_info(parts, list(remaining), currency) File “C:\Program Files\KiCad\6.0\bin\Lib\site-packages\kicost\distributors\api_octopart.py”, line 448, in query_part_info api_octopart.get_part_info(unsolved[slc]) File “C:\Program Files\KiCad\6.0\bin\Lib\site-packages\kicost\distributors\api_octopart.py”, line 211, in get_part_info for r in results: TypeError: ‘NoneType’ object is not iterable Progress: 0%| | 0/3 [00:00<?, ?part/s]

C:\Users\craig\Desktop\555\KiCAD>

  1. Write the command used to call KiCost (or the graphical interface configuration); kicost -w -i 555.xml --debug 8

  2. One BoM to reproduce the error (with the EDA version). 555.zip

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13

github_iconTop GitHub Comments

1reaction
set-softcommented, Nov 2, 2022

I performed an uninstall/install of KiCost on the problematic system, and now KiCost works on that system. Both prior to uninstall/install and after kicost --version said 1.1.13.

I suspect you had a mix of files from different versions

Being the not so trusting sort, I tried installing KiCost on a 3rd development system, also Windows 11 (the problematic system is Windows 10 which is now working).

Thanks for reporting, I patched the code so the setup.py can run even when TQDM isn’t installed.

0reactions
craigarnocommented, Nov 2, 2022

I performed an uninstall/install of KiCost on the problematic system, and now KiCost works on that system. Both prior to uninstall/install and after kicost --version said 1.1.13.

Being the not so trusting sort, I tried installing KiCost on a 3rd development system, also Windows 11 (the problematic system is Windows 10 which is now working).

I get this image

I did finally make it install, but had to

python -m pip install --upgrade pip
pip install tqdm
pip install bs4
pip install xlsxwriter
pip install validators

Before I could finally get:

>kicost --version
KiCost v1.1.13

image

KiCost now works on the 3rd system, which didn’t have KiCost previously installed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: 'NoneType' object is not iterable in Python
It means the value of data is None .
Read more >
Python TypeError: 'NoneType' object is not iterable Solution | CK
A None value is not iterable because it does not contain any objects. None represents a null value. There is a difference between...
Read more >
TypeError: NoneType object is not iterable when attempting to ...
Describe the bug When attempting to download subtitles I get the following error logs (this occurs on both Sonarr and Radarr): Job "Update ......
Read more >
Cannot Get KiCost to Run - External Plugins - KiCad.info Forums
Reading https://pypi.python.org/simple/kicost/ ... get_part_info(octopart_query, parts) ... TypeError: 'NoneType' object is not iterable.
Read more >
755390 – TypeError: 'NoneType' object is not iterable
Bug 755390 - TypeError: 'NoneType' object is not iterable ... libreport version: 2.0.6 executable: /usr/bin/python hashmarkername: anaconda ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found