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

module 'ssl' has no attribute 'wrap_socket' on python 3.12 #551

Closed
mundodisco8 opened this issue Oct 24, 2023 · 2 comments
Closed

module 'ssl' has no attribute 'wrap_socket' on python 3.12 #551

mundodisco8 opened this issue Oct 24, 2023 · 2 comments

Comments

@mundodisco8
Copy link

Issue / Problem report

  1. Installed the latest KiCost version (v1.1.18) in a clean virtual environment created with Python 3.12.
  2. Ran kicost -i hardware\MyProject.xml -c kicost.yaml --overwrite
    1. My config only has API keys for digikey
      kicost:
       version: 1
       # Cache Time To Live in days, -1 is forever
       # Default is 7
       cache_ttl: 30
       # Base directory for the APIs caches
       cache_path: ~/.cache/kicost
      
      
       APIs:
         Digi-Key:
           # Digi-Key Client ID for a registered APP
           client_id: myID
           # Digi-Key Client Secret for a registered APP
           client_secret: mySecret
           # Use the sandbox server, doesn't count the usage, but returns old data
           sandbox: false
           # Only enabled if the client_id and client_secret are defined
           enable: true
           # Directory for the APIs caches
           cache_path: ~/.cache/kicost/Digi-Key
           # Exclude products offered by 3rd party associates (marketplace)
           exclude_market_place_products: true
      
    2. My Digikey app has this https://localhost:8139/digikey_callback as its OAUTH callback. I have no idea what this is or means, or if it's the best way to do it, but I had no idea about how to configure it, and followed this guide.
  3. KiCost shows the login page on the browser
  4. KiCost shows the following error and exists.
- Digi-Key [api] (https://developer.digikey.com/)
WARNING:Oauth2 token storage does not exist or malformed, creating new. (kicost.distributors - log.py:107)
Progress:   0%|                                                                                                                                                                        | 0/13 [00:00<?, ?part/s]Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv\Scripts\kicost.exe\__main__.py", line 7, in <module>
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv\Lib\site-packages\kicost\__main__.py", line 479, in main
    main_real()
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv\Lib\site-packages\kicost\__main__.py", line 469, in main_real
    kicost(in_file=args.input, eda_name=args.eda,
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv\Lib\site-packages\kicost\kicost.py", line 249, in kicost
    query_part_info(parts, dist_list, currency)
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv\Lib\site-packages\kicost\kicost.py", line 76, in query_part_info
    get_dist_parts_info(parts, dist_list, currency)
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv\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:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv\Lib\site-packages\kicost\distributors\distributor.py", line 166, in get_dist_parts_info
    solved = api.query_part_info(parts, list(remaining), currency)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv\Lib\site-packages\kicost\distributors\api_digikey.py", line 208, in query_part_info
    api_digikey._query_part_info(parts, distributors, currency)
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv\Lib\site-packages\kicost\distributors\api_digikey.py", line 160, in _query_part_info
    data = o.search()
           ^^^^^^^^^^
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv\Lib\site-packages\kicost_digikey_api_v3\utils.py", line 112, in search
    results = kicost_digikey_api_v3.manufacturer_product_details(body=search_request, api_limits=self.api_limit, **DK_API.extra_ops)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv\Lib\site-packages\kicost_digikey_api_v3\v3\api.py", line 131, in manufacturer_product_details
    client = DigikeyApiWrapper('manufacturer_product_details_with_http_info', kicost_digikey_api_v3.v3.productinformation)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv\Lib\site-packages\kicost_digikey_api_v3\v3\api.py", line 50, in __init__
    self._digikeyApiToken = kicost_digikey_api_v3.oauth.oauth2.TokenHandler(version=3, sandbox=self.sandbox).get_access_token()
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv\Lib\site-packages\kicost_digikey_api_v3\oauth\oauth2.py", line 276, in get_access_token
    httpd.socket = ssl.wrap_socket(httpd.socket, certfile=filename, server_side=True)
                   ^^^^^^^^^^^^^^^
AttributeError: module 'ssl' has no attribute 'wrap_socket'
Progress:   0%|                                                                                                                                                                        | 0/13 [00:00<?, ?part/s]

If I repeat the same steps with a virtual environment created under Python 3.11, it works as expected. Even more, as it downloads the tokens, my Python 3.12 venv also works (after a successful run on the 3.11 venv).

I think this is relevant: python/cpython#94199 (comment).

  1. Add a terminal error report / txt, use --debug option on KiCost call;
    kicost -w -i %YOUR_FILE% --debug 8
DEBUG:Loading config from: C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\kicost.yaml (kicost - log.py:115)
DEBUG:Loaded API options (kicost - log.py:115)
DEBUG:- Digi-Key: (kicost - log.py:115)
DEBUG:  - client_id: YXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXY (kicost - log.py:115)
DEBUG:  - client_secret: NXXXXXXXXXXXXXXx (kicost - log.py:115)
DEBUG:  - sandbox: False (kicost - log.py:115)
DEBUG:  - enable: True (kicost - log.py:115)
DEBUG:  - cache_path: C:\Users\joel.santos\.cache\kicost\Digi-Key (kicost - log.py:115)
DEBUG:  - exclude_market_place_products: True (kicost - log.py:115)
DEBUG:- Element14: (kicost - log.py:115)
DEBUG:  - enable: False (kicost - log.py:115)
DEBUG:- Mouser: (kicost - log.py:115)
DEBUG:  - enable: False (kicost - log.py:115)
DEBUG:- Nexar: (kicost - log.py:115)
DEBUG:  - enable: False (kicost - log.py:115)
DEBUG:- TME: (kicost - log.py:115)
DEBUG:  - enable: False (kicost - log.py:115)
DEBUG:Final API options {'Digi-Key': {'client_id': 'myID', 'client_secret': 'mySecret', 'sandbox': False, 'enable': True, 'cache_path': 'C:\\Users\\joel.santos\\.cache\\kicost\\Digi-Key', 'exclude_market_place_products': True}, 'Element14': {'enable': False}, 'Mouser': {'enable': False}, 'Nexar': {'enable': False}, 'TME': {'enable': False}, 'Local': {}, 'KitSpace': {}} (kicost - log.py:115)
DEBUG:API options with defaults (kicost - log.py:115)
DEBUG:- Digi-Key: (kicost - log.py:115)
DEBUG:  - client_id: YXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXY (kicost - log.py:115)
DEBUG:  - client_secret: NXXXXXXXXXXXXXXx (kicost - log.py:115)
DEBUG:  - sandbox: False (kicost - log.py:115)
DEBUG:  - enable: True (kicost - log.py:115)
DEBUG:  - cache_path: C:\Users\joel.santos\.cache\kicost\Digi-Key (kicost - log.py:115)
DEBUG:  - exclude_market_place_products: True (kicost - log.py:115)
DEBUG:  - cache_ttl: 30 (kicost - log.py:115)
DEBUG:- Element14: (kicost - log.py:115)
DEBUG:  - enable: False (kicost - log.py:115)
DEBUG:  - cache_ttl: 30 (kicost - log.py:115)
DEBUG:  - cache_path: C:\Users\joel.santos\.cache\kicost\Element14 (kicost - log.py:115)
DEBUG:- Mouser: (kicost - log.py:115)
DEBUG:  - enable: False (kicost - log.py:115)
DEBUG:  - cache_ttl: 30 (kicost - log.py:115)
DEBUG:  - cache_path: C:\Users\joel.santos\.cache\kicost\Mouser (kicost - log.py:115)
DEBUG:- Nexar: (kicost - log.py:115)
DEBUG:  - enable: False (kicost - log.py:115)
DEBUG:  - cache_ttl: 30 (kicost - log.py:115)
DEBUG:  - cache_path: C:\Users\joel.santos\.cache\kicost\Nexar (kicost - log.py:115)
DEBUG:- TME: (kicost - log.py:115)
DEBUG:  - enable: False (kicost - log.py:115)
DEBUG:  - cache_ttl: 30 (kicost - log.py:115)
DEBUG:  - cache_path: C:\Users\joel.santos\.cache\kicost\TME (kicost - log.py:115)
DEBUG:- Local: (kicost - log.py:115)
DEBUG:  - cache_ttl: 30 (kicost - log.py:115)
DEBUG:  - cache_path: C:\Users\joel.santos\.cache\kicost\Local (kicost - log.py:115)
DEBUG:- KitSpace: (kicost - log.py:115)
DEBUG:  - cache_ttl: 30 (kicost - log.py:115)
DEBUG:  - cache_path: C:\Users\joel.santos\.cache\kicost\KitSpace (kicost - log.py:115)
DEBUG:Digi-Key API configured to enabled True id YXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXY secret NXXXXXXXXXXXXXXx path C:\Users\joel.santos\.cache\kicost\Digi-Key (kicost.distributors - log.py:115)
DEBUG:Digi-Key API plug-in options: (kicost.distributors - __init__.py:1527)
DEBUG:['DIGIKEY_STORAGE_PATH=C:\\Users\\joel.santos\\.cache\\kicost\\Digi-Key', 'DIGIKEY_CLIENT_ID=myID', 'DIGIKEY_CLIENT_SECRET=mySecret', 'DIGIKEY_CLIENT_SANDBOX=False'] (kicost.distributors - __init__.py:1527)
DEBUG:{} (kicost.distributors - __init__.py:1527)
DEBUG:Element14 API configured to enabled False key None path C:\Users\joel.santos\.cache\kicost\Element14 (kicost.distributors - log.py:115)
DEBUG:Mouser API configured to enabled False key None path C:\Users\joel.santos\.cache\kicost\Mouser (kicost.distributors - log.py:115)
DEBUG:Nexar API configured to enabled False id None secret None path C:\Users\joel.santos\.cache\kicost\Nexar (kicost.distributors - log.py:115)
DEBUG:TME API configured to enabled False token None app_secret None path C:\Users\joel.santos\.cache\kicost\TME (kicost.distributors - log.py:115)
DEBUG:Local API configured to enabled True (kicost.distributors - log.py:115)
DEBUG:KitSpace API configured to enabled False (kicost.distributors - log.py:115)
DEBUG:Started KiCost v1.1.18 (release) at Python 3.12.0 on Windows-11-10.0.22621-SP0(64bit). Graphical library: 4.2.1 msw (phoenix) wxWidgets 3.2.2.1. (kicost - log.py:115)
DEBUG:# Getting from XML 'LED_Dimmer.xml' KiCad BoM... (kicost.edas - log.py:115)
DEBUG:Getting authorship data... (kicost.edas - log.py:115)
DEBUG:Getting parts library... (kicost.edas - log.py:115)
DEBUG:Getting components... (kicost.edas - log.py:115)
DEBUG:# Removing do not populate parts... (kicost.edas - log.py:115)
DEBUG:Splitting subparts in the manufacture / distributors codes... (kicost.edas - log.py:115)
DEBUG:C1 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> 865080663020           part>>865080663020      qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': '1000μF', 'datasheet': 'https://www.we-online.com/components/products/datasheet/865080663020.pdf', 'libpart': 'Device:C_Polarized_Small', 'footprint': 'Gruffalo_Dimmer:Electrolytic Cap - ⌀16mm, h17mm - SMD - Handsolder', 'comments': 'Alternative PN 865060663015. Big cap to smooth inrush current on the LED strip. LEDs are 24V, so make sure are rated to at least 2x that.', 'digikey pn': '732-8465-1-ND', 'farnell pn': '2466347', 'manf#': '865080663020', 'manf': 'Wurth Electronic', 'tolerance': '±20%', 'vrating': '50V', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:C2 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> 3369310                part>>3369310   qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': '330nF', 'datasheet': 'https://product.samsungsem.com/mlcc/CL10B334KO8NNN.do', 'libpart': 'Device:C_Small', 'footprint': 'Gruffalo_Dimmer:0805-C_Handsolder', 'comments': "Any X7R, 0805, 50V cap. Farnell is alternative, as only sells Samsung's at 5k units", 'digikey pn': '1276-1123-1-ND', 'farnell pn': '3369310', 'manf#': '3369310', 'manf': 'Samsung', 'tolerance': 'X7R', 'vrating': '50V', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:C3 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> CL10B104KB8NNWC                part>>CL10B104KB8NNWC   qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': '100nF', 'datasheet': '~', 'libpart': 'Device:C_Small', 'footprint': 'Gruffalo_Dimmer:0603-1.6x0.8mm-C_Handsolder', 'comments': 'Any X7R, 0603, 10V cap. Farnell MPN is alternative', 'digikey pn': '1276-1935-1-ND', 'farnell pn': '1362556', 'manf#': 'CL10B104KB8NNWC', 'manf': 'Samsung', 'tolerance': 'X7R', 'vrating': '50V', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:D1 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> CUS08F30               part>>CUS08F30  qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': 'CUS08F30,H3F - p1/2', 'datasheet': 'https://toshiba.semicon-storage.com/info/CUS08F30_datasheet_en_20140414.pdf?did=9019&prodName=CUS08F30', 'sim.device': 'D', 'sim.pins': '1=K 2=A', 'libpart': 'Device:D_Small', 'footprint': 'Gruffalo_Dimmer:D_SOD-323_HandSoldering', 'comments': 'Any low drop voltage will do. Farnell PN is different part, but equivalent', 'digikey pn': 'CUS08F30H3FCT-ND', 'farnell pn': 'PMEG3005EB', 'manf#': 'CUS08F30', 'manf': 'Toshiba', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:part/qty>> H3F            part>>H3F       qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': 'CUS08F30,H3F - p2/2', 'datasheet': 'https://toshiba.semicon-storage.com/info/CUS08F30_datasheet_en_20140414.pdf?did=9019&prodName=CUS08F30', 'sim.device': 'D', 'sim.pins': '1=K 2=A', 'libpart': 'Device:D_Small', 'footprint': 'Gruffalo_Dimmer:D_SOD-323_HandSoldering', 'comments': 'Any low drop voltage will do. Farnell PN is different part, but equivalent', 'digikey pn': 'CUS08F30H3FCT-ND', 'farnell pn': 'PMEG3005EB', 'manf#': 'H3F', 'manf': 'Toshiba', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:J1 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> 532610871              part>>532610871 qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': 'Molex PicoBlade 53261-0871 1x08', 'datasheet': 'https://www.molex.com/molex/products/part-detail/pcb_headers/0532610871', 'libpart': 'Connector_Generic_MountingPin:Conn_01x08_MountingPin', 'footprint': 'Gruffalo_Dimmer:Receptacle - Molex PicoBlade - SMD Right Angle 1x08', 'comments': 'Molex PicoBlade 1x08, SMD, Right Angle. Mates with P/N 510210800, Crimps P/N 500798001 and 500798020', 'digikey pn': 'WM7626CT-ND', 'farnell pn': '1125376', 'manf#': '532610871', 'manf': 'Molex', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:Q1 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> 2N7002K-7              part>>2N7002K-7 qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': '2N7002K-7', 'datasheet': 'https://www.diodes.com/assets/Datasheets/2N7002K.pdf', 'libpart': 'Device:Q_NMOS_GDS', 'footprint': 'Gruffalo_Dimmer:SOT-23 - NMOS - GDS', 'comments': 'An NMOS with relatively low Rds on, that can confortably siwtch at 3V3 and handle switching 150mA@24V. The 2N7002 is cheap and cheerful and available from multiple manuf.', 'digikey pn': '2N7002K-7DICT-ND', 'farnell pn': '1713825', 'manf#': '2N7002K-7', 'manf': 'Diodes Inc.', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:Q2 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> 2N7002K-7              part>>2N7002K-7 qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': '2N7002K-7', 'datasheet': 'https://www.diodes.com/assets/Datasheets/2N7002K.pdf', 'libpart': 'Device:Q_NMOS_GDS', 'footprint': 'Gruffalo_Dimmer:SOT-23 - NMOS - GDS', 'comments': 'An NMOS with relatively low Rds on, that can confortably siwtch at 3V3 and handle switching 150mA@24V. The 2N7002 is cheap and cheerful and available from multiple manuf.', 'digikey pn': '2N7002K-7DICT-ND', 'farnell pn': '1713825', 'manf#': '2N7002K-7', 'manf': 'Diodes Inc.', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:Q3 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> 2N7002K-7              part>>2N7002K-7 qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': '2N7002K-7', 'datasheet': 'https://www.diodes.com/assets/Datasheets/2N7002K.pdf', 'libpart': 'Device:Q_NMOS_GDS', 'footprint': 'Gruffalo_Dimmer:SOT-23 - NMOS - GDS', 'comments': 'An NMOS with relatively low Rds on, that can confortably siwtch at 3V3 and handle switching 150mA@24V. The 2N7002 is cheap and cheerful and available from multiple manuf.', 'digikey pn': '2N7002K-7DICT-ND', 'farnell pn': '1713825', 'manf#': '2N7002K-7', 'manf': 'Diodes Inc.', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:U1 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> BGM220PC22WGA          part>>BGM220PC22WGA     qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': 'BGM220P', 'libpart': 'BGM220P_Breakout:BGM220P', 'footprint': 'BGM220P_Breakout:BGM220P_Header_SMD', 'datasheet': 'https://www.silabs.com/documents/public/data-sheets/bgm220p-datasheet.pdf', 'digikey pn': '336-BGM220PC22WGA2-ND', 'farnell pn': '3534710', 'manf#': 'BGM220PC22WGA', 'manf': 'Silabs', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:U2 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> L78L33ACD13TR          part>>L78L33ACD13TR     qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': 'L78L33A', 'footprint': 'Gruffalo_Dimmer:SO-8 - 6x4.9mm p1.27mm - L78L33A - ST', 'libpart': 'Gruffalo_Dimmer:L78L33A', 'datasheet': 'https://www.st.com/resource/en/datasheet/l78l.pdf', 'digikey pn': 'L78L33ACD-ND', 'farnell pn': '1564317', 'manf#': 'L78L33ACD13TR', 'manf': 'ST', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:C4 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> CL10B103KB8NNNC                part>>CL10B103KB8NNNC   qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': '10nF', 'datasheet': '~', 'libpart': 'Device:C_Small', 'footprint': 'Gruffalo_Dimmer:0603-1.6x0.8mm-C_Handsolder', 'comments': 'Any X7R, 0603, 10V cap.', 'digikey pn': '1276-1009-1-ND', 'farnell pn': '3013408', 'manf#': 'CL10B103KB8NNNC', 'manf': 'Samsung', 'tolerance': 'X7R', 'vrating': '50V', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:C5 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> CL10B103KB8NNNC                part>>CL10B103KB8NNNC   qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': '10nF', 'datasheet': '~', 'libpart': 'Device:C_Small', 'footprint': 'Gruffalo_Dimmer:0603-1.6x0.8mm-C_Handsolder', 'comments': 'Any X7R, 0603, 10V cap.', 'digikey pn': '1276-1009-1-ND', 'farnell pn': '3013408', 'manf#': 'CL10B103KB8NNNC', 'manf': 'Samsung', 'tolerance': 'X7R', 'vrating': '50V', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:R1 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> RC0805JR-0710KL                part>>RC0805JR-0710KL   qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': '10kΩ', 'datasheet': '~', 'libpart': 'Device:R_Small', 'footprint': 'Gruffalo_Dimmer:0805-R_Handsolder', 'comments': 'Any 10kΩ. Why are you buying these? You should have some somewhere in a box', 'digikey pn': '311-10KARCT-ND', 'farnell pn': '2073612', 'manf#': 'RC0805JR-0710KL', 'manf': 'Yageo', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:R2 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> RC0805JR-0710KL                part>>RC0805JR-0710KL   qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': '10kΩ', 'datasheet': '~', 'libpart': 'Device:R_Small', 'footprint': 'Gruffalo_Dimmer:0805-R_Handsolder', 'comments': 'Any 10kΩ. Why are you buying these? You should have some somewhere in a box', 'digikey pn': '311-10KARCT-ND', 'farnell pn': '2073612', 'manf#': 'RC0805JR-0710KL', 'manf': 'Yageo', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:R3 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> RC0805JR-0710KL                part>>RC0805JR-0710KL   qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': '10kΩ', 'datasheet': '~', 'libpart': 'Device:R_Small', 'footprint': 'Gruffalo_Dimmer:0805-R_Handsolder', 'comments': 'Any 10kΩ. Why are you buying these? You should have some somewhere in a box', 'digikey pn': '311-10KARCT-ND', 'farnell pn': '2073612', 'manf#': 'RC0805JR-0710KL', 'manf': 'Yageo', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:R4 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> RC0805JR-0710KL                part>>RC0805JR-0710KL   qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': '10kΩ', 'datasheet': '~', 'libpart': 'Device:R_Small', 'footprint': 'Gruffalo_Dimmer:0805-R_Handsolder', 'comments': 'Any 10kΩ. Why are you buying these? You should have some somewhere in a box', 'digikey pn': '311-10KARCT-ND', 'farnell pn': '2073612', 'manf#': 'RC0805JR-0710KL', 'manf': 'Yageo', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:R5 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> RC0805JR-0710KL                part>>RC0805JR-0710KL   qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': '10kΩ', 'datasheet': '~', 'libpart': 'Device:R_Small', 'footprint': 'Gruffalo_Dimmer:0805-R_Handsolder', 'comments': 'Any 10kΩ. Why are you buying these? You should have some somewhere in a box', 'digikey pn': '311-10KARCT-ND', 'farnell pn': '2073612', 'manf#': 'RC0805JR-0710KL', 'manf': 'Yageo', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:SW1 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> PEC11R-4115F-S0018             part>>PEC11R-4115F-S0018        qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': 'N/A', 'datasheet': 'https://www.bourns.com/docs/product-datasheets/pec11r.pdf?sfvrsn=bb617cbf_12', 'libpart': 'Device:RotaryEncoder_Switch', 'footprint': 'Gruffalo_Dimmer:Rotary Encoder - PEC11R - ∅11mm', 'comments': 'Any PEC11R-4XYYF-SZZZZ will do, but consider shaft size to fit case', 'digikey pn': 'PEC11R-4115F-S0018-ND', 'farnell pn': '2474846', 'manf#': 'PEC11R-4115F-S0018', 'manf': 'Bourns', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:C6 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> CL10B103KB8NNNC                part>>CL10B103KB8NNNC   qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': '10nF', 'datasheet': '~', 'libpart': 'Device:C_Small', 'footprint': 'Gruffalo_Dimmer:0603-1.6x0.8mm-C_Handsolder', 'comments': 'Any X7R, 0603, 10V cap.', 'digikey pn': '1276-1009-1-ND', 'farnell pn': '3013408', 'manf#': 'CL10B103KB8NNNC', 'manf': 'Samsung', 'tolerance': 'X7R', 'vrating': '50V', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:C7 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> CL10B103KB8NNNC                part>>CL10B103KB8NNNC   qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': '10nF', 'datasheet': '~', 'libpart': 'Device:C_Small', 'footprint': 'Gruffalo_Dimmer:0603-1.6x0.8mm-C_Handsolder', 'comments': 'Any X7R, 0603, 10V cap.', 'digikey pn': '1276-1009-1-ND', 'farnell pn': '3013408', 'manf#': 'CL10B103KB8NNNC', 'manf': 'Samsung', 'tolerance': 'X7R', 'vrating': '50V', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:R6 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> RC0805JR-0710KL                part>>RC0805JR-0710KL   qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': '10kΩ', 'datasheet': '~', 'libpart': 'Device:R_Small', 'footprint': 'Gruffalo_Dimmer:0805-R_Handsolder', 'comments': 'Any 10kΩ. Why are you buying these? You should have some somewhere in a box', 'digikey pn': '311-10KARCT-ND', 'farnell pn': '2073612', 'manf#': 'RC0805JR-0710KL', 'manf': 'Yageo', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:R7 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> RC0805JR-0710KL                part>>RC0805JR-0710KL   qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': '10kΩ', 'datasheet': '~', 'libpart': 'Device:R_Small', 'footprint': 'Gruffalo_Dimmer:0805-R_Handsolder', 'comments': 'Any 10kΩ. Why are you buying these? You should have some somewhere in a box', 'digikey pn': '311-10KARCT-ND', 'farnell pn': '2073612', 'manf#': 'RC0805JR-0710KL', 'manf': 'Yageo', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:R8 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> RC0805JR-0710KL                part>>RC0805JR-0710KL   qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': '10kΩ', 'datasheet': '~', 'libpart': 'Device:R_Small', 'footprint': 'Gruffalo_Dimmer:0805-R_Handsolder', 'comments': 'Any 10kΩ. Why are you buying these? You should have some somewhere in a box', 'digikey pn': '311-10KARCT-ND', 'farnell pn': '2073612', 'manf#': 'RC0805JR-0710KL', 'manf': 'Yageo', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:R9 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> RC0805JR-0710KL                part>>RC0805JR-0710KL   qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': '10kΩ', 'datasheet': '~', 'libpart': 'Device:R_Small', 'footprint': 'Gruffalo_Dimmer:0805-R_Handsolder', 'comments': 'Any 10kΩ. Why are you buying these? You should have some somewhere in a box', 'digikey pn': '311-10KARCT-ND', 'farnell pn': '2073612', 'manf#': 'RC0805JR-0710KL', 'manf': 'Yageo', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:R10 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> RC0805JR-0710KL                part>>RC0805JR-0710KL   qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': '10kΩ', 'datasheet': '~', 'libpart': 'Device:R_Small', 'footprint': 'Gruffalo_Dimmer:0805-R_Handsolder', 'comments': 'Any 10kΩ. Why are you buying these? You should have some somewhere in a box', 'digikey pn': '311-10KARCT-ND', 'farnell pn': '2073612', 'manf#': 'RC0805JR-0710KL', 'manf': 'Yageo', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:SW2 >> ['manf#'] (kicost.edas - log.py:115)
DEBUG:part/qty>> PEC11R-4115F-S0018             part>>PEC11R-4115F-S0018        qty>>1 (kicost.edas - log.py:115)
DEBUG:OrderedDict({'value': 'N/A', 'datasheet': 'https://www.bourns.com/docs/product-datasheets/pec11r.pdf?sfvrsn=bb617cbf_12', 'libpart': 'Device:RotaryEncoder_Switch', 'footprint': 'Gruffalo_Dimmer:Rotary Encoder - PEC11R - ∅11mm', 'comments': 'Any PEC11R-4XYYF-SZZZZ will do, but consider shaft size to fit case', 'digikey pn': 'PEC11R-4115F-S0018-ND', 'farnell pn': '2474846', 'manf#': 'PEC11R-4115F-S0018', 'manf': 'Bourns', 'manf#_qty': '1'}) (kicost.edas - log.py:115)
DEBUG:# Grouping parts... (kicost.edas - log.py:115)
DEBUG:Getting groups of identical components... (kicost.edas - log.py:115)
DEBUG:Checking the seemingly identical parts group... (kicost.edas - log.py:115)
DEBUG:Merging field asked in the identical components groups... (kicost.edas - log.py:115)
DEBUG:Propagating field values to identical components... (kicost.edas - log.py:115)
DEBUG:Distributors: ['digikey'] (kicost - log.py:115)
DEBUG:Qty>> ['C1']       1.0*865080663020 (kicost.edas - log.py:115)
DEBUG:Qty>> ['C2']       1.0*3369310 (kicost.edas - log.py:115)
DEBUG:Qty>> ['C3']       1.0*CL10B104KB8NNWC (kicost.edas - log.py:115)
DEBUG:Qty>> ['D1#1']     1.0*CUS08F30 (kicost.edas - log.py:115)
DEBUG:Qty>> ['D1#2']     1.0*H3F (kicost.edas - log.py:115)
DEBUG:Qty>> ['G1']       1*None (kicost.edas - log.py:115)
DEBUG:Qty>> ['J1']       1.0*532610871 (kicost.edas - log.py:115)
DEBUG:Qty>> ['Q1', 'Q2', 'Q3']   3.0*2N7002K-7 (kicost.edas - log.py:115)
DEBUG:Qty>> ['U1']       1.0*BGM220PC22WGA (kicost.edas - log.py:115)
DEBUG:Qty>> ['U2']       1.0*L78L33ACD13TR (kicost.edas - log.py:115)
DEBUG:Qty>> ['C4', 'C5', 'C6', 'C7']     4.0*CL10B103KB8NNNC (kicost.edas - log.py:115)
DEBUG:Qty>> ['R1', 'R2', 'R3', 'R4', 'R5', 'R6', 'R7', 'R8', 'R9', 'R10']        10.0*RC0805JR-0710KL (kicost.edas - log.py:115)
DEBUG:Qty>> ['SW1', 'SW2']       2.0*PEC11R-4115F-S0018 (kicost.edas - log.py:115)
DEBUG:Scrape API list ['Local', 'Digi-Key', 'Mouser(Disabled)', 'Element14(Disabled)', 'TME(Disabled)', 'Nexar(Disabled)', 'KitSpace(Disabled)'] (kicost - log.py:115)
DEBUG:Starting to search using distributors: ['digikey'] (kicost.distributors - log.py:115)
DEBUG:Distributors after local discovery: ['digikey'] (kicost.distributors - log.py:115)
DEBUG:Considering: Local [] (kicost.distributors - log.py:115)
DEBUG:Considering: Digi-Key ['digikey'] (kicost.distributors - log.py:115)
- Digi-Key [api] (https://developer.digikey.com/)
DEBUG:# Getting part data from Digi-Key... (kicost.distributors - log.py:115)
DEBUG:
**** Manufacturer: Wurth Electronic P/N: 865080663020 (kicost.distributors - log.py:115)
DEBUG:Looking in cache C:\Users\joel.santos\.cache\kicost\Digi-Key\mpn_865080663020_US_en_USD_US.dat (kicost.distributors - log.py:115)
DEBUG:Using API V3 (kicost.distributors - __init__.py:1527)
WARNING:Oauth2 token storage does not exist or malformed, creating new. (kicost.distributors - log.py:107)
DEBUG:AUTH - Authenticating with endpoint https://api.digikey.com/v1/oauth2/authorize using ID: YxhlEVCGcsMC3vS2bngL18Dj7C8... (kicost.distributors - __init__.py:1527)
DEBUG:AUTH - Redirect URL: https://localhost:8139/digikey_callback (kicost.distributors - __init__.py:1527)
Progress:   0%|                                                                                                                                                                        | 0/13 [00:00<?, ?part/s]Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv12\Scripts\kicost.exe\__main__.py", line 7, in <module>
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv12\Lib\site-packages\kicost\__main__.py", line 479, in main
    main_real()
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv12\Lib\site-packages\kicost\__main__.py", line 469, in main_real
    kicost(in_file=args.input, eda_name=args.eda,
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv12\Lib\site-packages\kicost\kicost.py", line 249, in kicost
    query_part_info(parts, dist_list, currency)
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv12\Lib\site-packages\kicost\kicost.py", line 76, in query_part_info
    get_dist_parts_info(parts, dist_list, currency)
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv12\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:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv12\Lib\site-packages\kicost\distributors\distributor.py", line 166, in get_dist_parts_info
    solved = api.query_part_info(parts, list(remaining), currency)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv12\Lib\site-packages\kicost\distributors\api_digikey.py", line 208, in query_part_info
    api_digikey._query_part_info(parts, distributors, currency)
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv12\Lib\site-packages\kicost\distributors\api_digikey.py", line 160, in _query_part_info
    data = o.search()
           ^^^^^^^^^^
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv12\Lib\site-packages\kicost_digikey_api_v3\utils.py", line 112, in search
    results = kicost_digikey_api_v3.manufacturer_product_details(body=search_request, api_limits=self.api_limit, **DK_API.extra_ops)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv12\Lib\site-packages\kicost_digikey_api_v3\v3\api.py", line 131, in manufacturer_product_details
    client = DigikeyApiWrapper('manufacturer_product_details_with_http_info', kicost_digikey_api_v3.v3.productinformation)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv12\Lib\site-packages\kicost_digikey_api_v3\v3\api.py", line 50, in __init__
    self._digikeyApiToken = kicost_digikey_api_v3.oauth.oauth2.TokenHandler(version=3, sandbox=self.sandbox).get_access_token()
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\joel.santos\OneDrive - Brompton Bicycle Ltd\Desktop\Gruffalo_Dimmer\venv12\Lib\site-packages\kicost_digikey_api_v3\oauth\oauth2.py", line 276, in get_access_token
    httpd.socket = ssl.wrap_socket(httpd.socket, certfile=filename, server_side=True)
                   ^^^^^^^^^^^^^^^
AttributeError: module 'ssl' has no attribute 'wrap_socket'
Progress:   0%|
  1. Write the command used to call KiCost (or the graphical interface configuration);

kicost -i hardware\MyProject.xml -c kicost.yaml --overwrite

  1. One BoM to reproduce the error (with the EDA version).

Example.zip from Kicad 7.0.7

@mundodisco8
Copy link
Author

I took the liberty of messing with the kicost-digikey-api-v3 code and managed to get it working, but I'm not very good at this so more work might be needed.

set-soft/kicost-digikey-api-v3#1

Feel free to reject if it's not good enough.

@set-soft
Copy link
Collaborator

set-soft commented Nov 8, 2023

Hi @mundodisco8 !
The patch is now merged and included in v0.1.3 release.

@set-soft set-soft closed this as completed Nov 8, 2023
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