Giter VIP home page Giter VIP logo

kicost's People

Contributors

adamheinrich avatar daglem avatar diorcety avatar fschrempf avatar glcerone avatar hildogjr avatar johnthagen avatar karlp avatar kasbah avatar mdeweerd avatar mmmaisel avatar set-soft avatar sliedes avatar stevenj avatar xesscorp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kicost's Issues

Run as a bom Plugin

Kicost can be installed into a virtual env and then run as a bom plugin. Maybe could update the docs to include how to do it.

This is how i do it:
Create BOM plugin with

Name:

KiCost

Command Line:

"/usr/local/bin/venv-run.sh" kicost kicost -d 1 -i "%I"  -o "%O.xlsx" --overwrite

The script /usr/local/bin/venv-run.sh is as follows:

#!/bin/bash
# if virtualenvwrapper.sh is in your PATH (i.e. installed with pip)
#source `which virtualenvwrapper.sh`
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh # if it's not in your PATH
workon $1
shift
"$@"
deactivate

Ignoring "desc" to group components -> value absent from report

As the description field is used as a condition to group components, I added it to the ignore list:
kicost -d 10 -i input.xml -o ${TMPFILE} -var default --overwrite -np 5 --ignore_fields desc h

The description field is then also absent from the excel report.

The 'desc' field should be considered the same way as the "manf#" field, or ignored fields should be stored, but only be ignored for the hashing.

Enhancement: Part Fields

At the moment the part fields are "manf#" and "newark#", "digikey#", "mouser#"

It would be nice if the supplier specific fields were documented in the docs on how to use KiCost.

As the program grows, I could imagine more custom fields being used. Would it make sense to create some sort of field name space, so that other programs wont clash with the fields dedicated to kicost. Something like "KiCost:manf#" instead of "manf#", etc. It might also make the Schematic fields more self documenting, when someone other than the author see's those fields they have some idea of their purpose or at least when they google search "KiCost:manf#" it will probably turn up something useful.

The script calculates the wrong price for eu.mouser.com/pl.mouser.com.

I live in Europe and script for the mouser store is redirected to the page eu.mouser.com or pl.mouser.com where prices are given in euros (€).
For example QTY=1:
Digikey, and Newark correctly indicate the price Pic12F508-I / SN = $0,56
For eu.mouser.com default currency is euro.
The script displays the price, multiplied by 100, ie. Price = $ 615.00.
Properly should be €0,0615 -> $0,688

No-pop parts

Don't add prices for parts in the schematic that aren't meant to be populated on the final board.

Component grouping - limiting the hash calculation to known fields?

For the context: Before I discovered KiCost, I started to work on a basic solution - just adding a set of known 6+ fields to every components such as 'Digikey PN', 'DigiKey Price x1', 'DigiKey Price x1000', 'Mouser PN', etc
My BOM is not huge but long enough to get bored after adding these fields for the first 5 components. At that time I thought it would be a nice project to automate the process.
Luckily before I started to work on it I found your project! After fixing the issue #46, the project has been working fine with my BOM.

Except... I found that KiCost was not able to group my 4 10K resistors together. It only managed to do 2 pairs of 10K resistor.
I started to debug KiCost get_part_groups() and I found this code:

        # Take the field keys and values of each part and create a hash.
        # Use the hash as the key to a dictionary that stores lists of
        # part references that have identical field values. The important fields
        # are the reference prefix ('R', 'C', etc.), value, and footprint.
        # Don't use the manufacturer's part number when calculating the hash!
        # Also, don't use any fields with SEPRTR in the label because that indicates
        # a field used by a specific tool (including kicost).
        hash_fields = {k: fields[k] for k in fields if k not in ('manf#','manf') and SEPRTR not in k}

My set of component is this one:

'R5': {u'footprint': 'Resistors_SMD:R_0603_HandSoldering', u'libpart': 'device:R', 'reference': 'R', 'value': '10K', 'manf#': 'ERJ-3EKF1002V'},
'R6': {u'footprint': 'Resistors_SMD:R_0603_HandSoldering', u'libpart': 'device:R', 'reference': 'R', 'value': '10K', 'manf#': 'ERJ-3EKF1002V'},
'R2': {u'libpart': 'device:R', 'reference': 'R', 'digikey price x1000': '0.00379', 'value': '10K', 'manf#': 'ERJ-3EKF1002V', 'digikey price x1': '0.1', u'footprint': 'Resistors_SMD:R_0603_HandSoldering', 'manufacturer pn': 'ERJ-3EKF1002V', 'digikey pn': 'P10.0KHCT-ND'},
'R3': {u'libpart': 'device:R', 'reference': 'R', 'digikey price x1000': '0.00379', 'value': '10K', 'manf#': 'ERJ-3EKF1002V', 'digikey price x1': '0.1', u'footprint': 'Resistors_SMD:R_0603_HandSoldering', 'manufacturer pn': 'ERJ-3EKF1002V', 'digikey pn': 'P10.0KHCT-ND'}}

You can see R2 and R3 have still got my initial fields.

I understand two similar components with different fields might have a different meaning. But I am wondering if a set of component which have the same manf# should always be merged together (and maybe print a warning if the hash do not correspond).

And/Or the hash could be limited to some known fields such as 'footprint', 'libpart', 'reference', 'value'.

Multiple BOM line items for a single reference designator

I propose a future enhancement, if it wouldn't be too cumbersome, to allow multiple line items to be added to the BOM spreadsheet based on a single component in the schematic. For example, a 2-pin jumper might add both a 2-pin header and a shunt. Or a mounting hole might add a screw, standoff and lockwasher. Or maybe I create a single component that represents something like an Arduino or an STM32F Discovery board plugged in as a daughtercard, with a custom footprint that has all of the various headers and mounting holes properly located, and I'd like multiple header strips or sockets to be added to the BOM based on that one component.

I think this would be a nice feature if there's a clean way to specify multiple part numbers with corresponding quantities in the fields of a component. I haven't thought much yet about how that might be cleanly accomplished, so maybe it would end up being too clumsy to be practical.

TypeError exception

Using an unknown older version of KiCost, I was getting zero quantity available for all items from Digi-Key, even for items in stock. I upgraded to the latest version of KiCost (0.1.27, as of 2016-08-11), and now it instead crashes with a TypeError exception after (I think) completing the scraping. Running with -d 5, here is the tail end of the console output:

running the remaining "atexit" finalizers
process exiting with exitcode 0
process exiting with exitcode 0
process exiting with exitcode 0
process exiting with exitcode 0
process exiting with exitcode 0
process exiting with exitcode 0
Traceback (most recent call last):
  File "/usr/local/bin/kicost", line 9, in <module>
    load_entry_point('kicost==0.1.27', 'console_scripts', 'kicost')()
  File "/usr/local/lib/python2.7/dist-packages/kicost-0.1.27-py2.7.egg/kicost/__main__.py", line 159, in main
    variant=args.variant, num_processes=num_processes)
  File "/usr/local/lib/python2.7/dist-packages/kicost-0.1.27-py2.7.egg/kicost/kicost.py", line 160, in kicost
    id, url, part_num, price_tiers, qty_avail = result.get()
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 558, in get
    raise self._value
TypeError: ord() expected string of length 1, but int found
Exception TypeError: TypeError("'NoneType' object is not callable",) in  ignored

My initial attempts at debugging the issue have only resulted in pouting and confusion. I am open to suggestions for further debugging.

KiCost finds 0 inventory for everything at digikey

Hello,

Great plugin. I'm noticing, however, that parts that are found at digikey with a manual search by manf# show an available in-stock quantity, but KiCost reports that there is none in stock. In fact, it reports this for everything from digikey.

I'm using 1.23, managed by the AUR for Arch Linux.

Use logging module

Why not to use standard logging module?
Also i think that kicost should produce some progress info like when -d1 passed.

Perhaps another good idea is to use python-progressbar for data retrieving step.

Support for other currencies

Would be great to have support for international websites and other currencies.
I'm based in the uk, and access Farnell through uk.farnell.com for instance.
Would it be possible to implement this? How could I help?

Spread Sheet Missig entries for a part it found at digikey

The spreadsheet built by kicost put no entry for a component that was in my KiCad BOM. Utilizing the Debug features (of KiCost), I know it found the part (at digikey) and was able to scrap the pricing information from the website.

Marking parts not found at any distributor

Instead of coloring cells green when all distributors show as blank (no part found) - it would be best to color all cells red instead. This will help identify where no part was found.

Add price break to each component as a comment in the Purch column

As the title says, a comment that describes the different price breaks for that distributor would help deciding to buy in bulk or not on each component.

Digi-key has this function in their shopping cart, when hovering over a quantity you get a pop-up with e.g.
Price Break Unit Price Extended Price
1 0,85000 0,85
10 0,50800 5,08
50 0,27580 13,79
100 0,23270 23,27

This would be great to have in the spreadsheet!

Automatic specify generic components

Things like resistors and caps are quite generic. It would be nice if there was a way for kicost to lookup these types of components based on their parameters (type, value, package). And then pick the most cost effective one for that job. Not sure the best way to achieve that, but it would be nice.

If the suppliers cant be directly queried based on the parameters than another way would be to have a generic part database, CSV for example, which maps the component parameters to known parts, but then someone would have to maintain that. However, it could be locally maintained, so that once you have verified that the Yageo 0.1uf Cap is just as good as the Murata 0.1uf Cap you add that to your own local list of Generics.

Just an idea.

Part data entry via spreadsheet

Allow entry of BOM type data (manufacturer/manufacturer part number) into a spreadsheet (CSV) and allow import of this into the kicad project files so I can fill in manf and manf# using a spreadsheet rather than Kicad.

Desc field remains empty

It is unclear how to get the 'Desc' column filled correctly.

I filled in the 'desc' fields of the schematic components, but the column remains empty.

I've tried some code changes but I did not succeed in making this work.

Price shown as zero for items that are out-of-stock at Newark

If a component is found from Newark, but it is out of stock, the spreadsheet will have a price of 0$ for that item. As this is obviously cheaper than any other price, the result for the whole BOM will then be wrong.

For example, if the BOM contains manf# RC0603FR-0743K2L, then the Newark site gives the result (at least on 28th Jan 2016) http://www.newark.com/yageo/rc0603fr-0743k2l/resistor/dp/66R2398?ost=RC0603FR-0743K2L&selectedCategoryId= , which gets entered as zero on the spreadsheet, and the price for that component in the final BOM will be 0 independent of availability and pricing at other distributors.

QTY Available 0

There are 2 reasons to use KiCost,

1 is for manufacturing NOW. So i can buy the cheapest parts NOW to build a board.
Another is to get budgetary prices for your board.

In the first case, KiCost is great, as it removes any parts from a supplier with 0 Qty. But in the second case, thats not very useful because we dont care if we can get the parts right now, we just care "if" we can get the parts whats the BOM cost. Maybe the parts are on 2 week lead time and thats OK for you.

I propose we need a option that tells Kicad no to ignore parts that have 0 Qty Available, as long as the price is valid and the part was able to be scraped from a supplier. Then KiCost can fulfil both roles.

Short, non-unique part numbers not found.

Components with short, non-unique part numbers often aren't found at any vendor. For example, Keystone Electronics part number 5010, with Digi-Key number 36-5010-ND. I can work around this by adding a digikey# field for each affected part. Presumably, I could add other vendor-specific part numbers, but I have only tried with Digi-Key. I attempted adding a "manf" field containing "Keystone Electronics" (the vendor name as displayed on the Digi-Key page for that component), but that did not work.

Part value auditing

Parse device value (for R, C, L, similar where typically "value" field holds the value such as 100k, 4.7uF, 2 uH) and compare to distributor site value. All match - green, some mismatch - yellow (warning), all mismatch - red. Thought is to have some part information auditing while we're at it

Variants and "same" components - BOM incorrect

In order to build the right BOM and cost estimate for several variants, I have added fields like this (example for 100nF):

kicost.eth:manf# - GRM155R71A104KA01D
manf# - GRM155R71A104KA01D
kicost.rtc:manf# - GRM155R71A104KA01D

Unfortunately, in some variant combinations all 100nF capacitors are added, and in some combinations, none of the 100nF capacitors are added, while in practice just a few should be added to the BOM in any combination.

PartNumber field in EEschema

Hi,
I have just installed and run Kicost in Ubuntu 14.04 Kicad 4.01 stable and xsltproc. I used:
sudo easy_install3 kicost
It runs very well, I am able to get prices for my parts.
Thank you very much for this software!!
I have noticed, that in schematic libs in version 4.01 there are default PartNumber fields in every standard library.
Would it take lots of work to be able to choose, whether to use manf# or PartNumber? Or maybe both, with manf# superseding PartNumber?
It would save me lots of work to change the libraries one by one to add manf#
What do you think?

Ignore certain parts using their reference prefix as a filter

The other items would be to allow a command-line option to ignore certain refdes alpha-parts. Since different people may have different conventions, I would have a line like:

c:\python27\scripts\kicost -i my schematic.xml -g tp,dh

Where after -g ("i" was already taken - g for iGnore) is a comma separated list of "whole word" alpha portions of the reference designator to ignore and case insensitive. TP* for me are testpoints. DH* for me are drill holes. If I were to do a -g t,dh in this example, then the "-g t" would not ignore "TP" as the "t" has to match the entire alpha part before the number part. Exact case-insensitive match.

I just took all of my TP and DH parts and assigned INSTALL=N which tells my script not to assign manf/manf# fields to these parts. I was already doing this since my CSV file which is used as a lookup table to inject manf/manf# into the schematic did not have TP or DH refdes(es) in the CSV which also served to keep manf/manf# from being injected. But the idea that occurred to me is that if there was a switch to ignore blank manf/manf# so the spreadsheet just wouldn't list these - that would work as well. It'd be better not to have to filter these out by doing extra work on the front-end (better to use the -g switch which can be scripted and requires no extra effort) - but having the option to remove blank manf/manf# parts from the list would be good. Maybe -b (- for ignore b for blank). I'd normally run without this switch at first to see if there's anything missing a manf/manf# pair that I thought should have one. But then -b for subsequent runs.

Allow custom pricing for non-distributor parts

Import of custom part pricing from some source (CSV, command-line, etc.) This one is not as high because at some point some of this custom stuff is not work the dev time to setup or maintain. Part is influenced by running the script a lot because I'm trying to fix things -- now that I'm fairly fixed - I think it's usable to start manually editing the spreadsheet I have rather than generating more. However, I'll throw this out there. Many times I have to spec a clock part which is a custom SKU with parameters not available from distributors. I therefore get the clocks direct from the manufacturer and these will never cross-ref. pricing at any distributor. The thought would be some mechanism for defining the cost of these parts and get these sucked into KiCost when a run is made. My process right now is going to be to fill in the price by hand based off of quotes I have in email.

Use KiField as a library?

I am not too familiar with this code base but I just noticed it isn't using KiField as a libarary as I had previously thought. What would you think about re-using the extraction code from KiField here?

Wrong product being returned from Mouser

Hi,
I've installed latest Kicost (0.1.31) from ubuntu ppa. I've run it using as source the default BOM xml exported by Kicad.
I'm facing an issue where KiCost is returning the wrong product from Mouser.
In the manfp# column in BOM I have B3U-1000P, but Kicost is returning this product: 653-B5T001001G from Mouser only.


I just noted that this same product was not returned for Digikey columns, but they have it (http://www.digikey.com/products/en?keywords=B3U-1000P).

may I missing something ?

Add custom fields in global part info

Allow for other fields to be listed. "-a room,install" as an example would add a field named "ROOM" (case insensitive) and "INSTALL" to the global part info part. Suggest order as Refs, Value, Desc, [-a custom field 1], [-a custom field 2], [-a custom field ...], Footprint, Manf, Manf#, Qty, Unit$, Ext$. Basically, stick the custom fields (if requested) between "Desc" and "Footprint" . My example would show the field ROOM which I'm about to add now as ROOM="New Temp Sensor" for all parts that are part of the new temp sensor I've added. I want to show the cost of this solution to management so I'm making a room to sort on to bring together all the costs for this feature. For now I'm going to make a "desc" field to do this - but wouldn't mind being able to pull in custom fields to KiCost.

It would be nice if the context shortcut shown in the video was documented

Just for reference this is what I use... It runs kicost with debug level 1, overwrite and the file argument then drops out to the python shell.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\xmlfile\shell\Open with KiCost]

[HKEY_CLASSES_ROOT\xmlfile\shell\Open with KiCost\command]
@="C:\\\\msys64\\\\mingw64\\\\bin\\\\python.exe -i -m  kicost -d 1 -w -i %1"

0 Qty

Hi there,
i've just installed kicost using easy install, worked like a charm :)

I added manf# fields to all components in Esschema, created a BOM and used kicost on it.

Afterwards i do get an xlsx created with all parts needed, their footprints, manf# and stuff, but the quantity of each item remains zero.
Which means each and every pcb does cost 0,00$, until i change the quantity of some items.
(So Kicost did get the price of each item)

Any ideas on what i might have done wrong?

Errors/not running files

Hello,
I have a problem not runnig some bom's;
WIN10, with kicost installation and drag&drop batch file (i just drag xml file and drop over KiCost.bat to do the job)
KiCost.bat file content:
""""""""""""""""""""""""""""""""
@echo off
set path=C:\python27
set SOURCE=%1
cd C:\Python27\Lib\site-packages
python kicost -v
@echo File to process: %SOURCE%
python kicost -i %SOURCE%
pause
"""""""""""""""""""""""""""""""""""""""""""""""""
Certain xml bom files are not running, throwing out errors, other BOM XML files are running fine (smaller stuff) paste of the error:
""""""""""""""""""""""""""""""
KiCost 0.1.10
File to process: "C:\Users\blanked\Desktop\Handheld board.xml"
Traceback (most recent call last):
File "C:\python27\lib\runpy.py", line 162, in run_module_as_main
"main", fname, loader, pkg_name)
File "C:\python27\lib\runpy.py", line 72, in run_code
exec code in run_globals
File "C:\Python27\Lib\site-packages\kicost__main
.py", line 84, in
main()
File "C:\Python27\Lib\site-packages\kicost__main__.py", line 80, in main
kicost(in_file=args.input, out_filename=args.output, debug_level=args.debug)
File "kicost\kicost.py", line 93, in kicost
parts = get_part_groups(in_file)
File "kicost\kicost.py", line 133, in get_part_groups
for p in root.find('libparts').find_all('libpart'):
AttributeError: 'NoneType' object has no attribute 'find_all'
Press any key to continue . . .
"""""""""""""""""""""""""""""""""""""""""""""""""""""

It is fairly large BOM with 370 components, i did add "manf#" in there as a field (it is too big to paste it here) plus does not take xml when dragging&dropping here...
The app is running some other XML bom's which is weird...

example from xml:
""""""""""""""""""""""""""""""
comp ref="U31">
value>OPA2228
footprint>w_smd_dil:so-8
datasheet>OPA2228UA/2K5
fields>
field name="manf#">OPA2228UA/2K5
/fields>
libsource lib="Handheld board-cache" part="OPA2228"/>
sheetpath names="/ref_detector/" tstamps="/55F41B07/"/>
tstamp>55E61ADA
/comp>
""""""""""""""""""""""
I had to delete all the starting arrows from xml part example in order to see the code after i submit the post all the formatting is gone, looks weird...

Extra parameter parsing

Parse other fields similar to value (voltage, tolerance, etc). There's not a standard for how this is organized so it's difficult to support.

Sheet name "too long"

The sheet name is based on the variants and as I divided the design into several options I got this error:
me
Exception: Excel worksheet name 'KiCost.rf_eth_usb_rtc_jack_header' must be <= 31 chars.

I worked around this by having a fixed sheet name.

I think it is better to indicate the variants in the sheet's content itself.

Thank you.

main sheet without name.. error?

XML file goes like this:

<?xml version="1.0" encoding="UTF-8"?>
<export version="D">
  <design>
    <source>E:/Data_KiCAD/Projects/RPi-Test/RPi-Test.sch</source>
    <date>13/06/16 23:18:59</date>
    <tool>Eeschema (2016-03-04 BZR 6608, Git ba038ac)-product</tool>
    <sheet number="1" name="/" tstamps="/">
      <title_block>
        <title/>
        <company/>
        <rev/>
        <date/>
        <source>RPi-Test.sch</source>
        <comment number="1" value=""/>
        <comment number="2" value=""/>
        <comment number="3" value=""/>
        <comment number="4" value=""/>
      </title_block>
    </sheet>
    ....
</export>

And the error is then this:

Get schematic XML...
Get parts library...
Traceback (most recent call last):
  File "C:\Python27\Scripts\kicost-script.py", line 9, in <module>
    load_entry_point('kicost==0.1.25', 'console_scripts', 'kicost')()
  File "c:\python27\lib\site-packages\kicost-0.1.25-py2.7.egg\kicost\__main__.py", line 159, in main
    variant=args.variant, num_processes=num_processes)
  File "c:\python27\lib\site-packages\kicost-0.1.25-py2.7.egg\kicost\kicost.py", line 113, in kicost
    parts = get_part_groups(in_file, ignore_fields, variant)
  File "c:\python27\lib\site-packages\kicost-0.1.25-py2.7.egg\kicost\kicost.py", line 246, in get_part_groups
    fields = extract_fields(p, variant)
  File "c:\python27\lib\site-packages\kicost-0.1.25-py2.7.egg\kicost\kicost.py", line 207, in extract_fields
    name = str(f['name'].lower().strip())
  File "c:\python27\lib\site-packages\beautifulsoup4-4.4.1-py2.7.egg\bs4\element.py", line 958, in __getitem__
    return self.attrs[key]
KeyError: u'name'

To make this error vanish and get to the next step I have to add some string into the name field for sheet 1.
Which brings me to this error:

Get schematic XML...
Get parts library...
Get components...
Traceback (most recent call last):
  File "C:\Python27\Scripts\kicost-script.py", line 9, in <module>
    load_entry_point('kicost==0.1.25', 'console_scripts', 'kicost')()
  File "c:\python27\lib\site-packages\kicost-0.1.25-py2.7.egg\kicost\__main__.py", line 159, in main
    variant=args.variant, num_processes=num_processes)
  File "c:\python27\lib\site-packages\kicost-0.1.25-py2.7.egg\kicost\kicost.py", line 113, in kicost
    parts = get_part_groups(in_file, ignore_fields, variant)
  File "c:\python27\lib\site-packages\kicost-0.1.25-py2.7.egg\kicost\kicost.py", line 274, in get_part_groups
    fields = libparts[libpart].copy()  # Make a copy! Don't use reference!
KeyError: 'Power:VoltRef_MAX6034_2.5V_SOT323'

That part is the last in the libparts list and the 2nd in the components list.

Shows error for particular xml file alone

Hi All,
When i run attached particular file in the command for Kicost. It shows below error message. The file size is 175kb, is this a issue?
BoulderCreekMotherBoard.zip

Error

C:\Python27\Scripts>kicost -i C:\Python27\Scripts\BoulderCreekMotherBoard.xml
Traceback (most recent call last):
File "C:\Python27\Scripts\kicost-script.py", line 9, in
load_entry_point('kicost==0.1.19', 'console_scripts', 'kicost')()
File "c:\python27\lib\site-packages\kicost__main__.py", line 132, in main
num_processes=num_processes)
File "c:\python27\lib\site-packages\kicost\kicost.py", line 110, in kicost
parts = get_part_groups(in_file, ignore_fields, variant)
File "c:\python27\lib\site-packages\kicost\kicost.py", line 216, in get_part_g
roups
for p in root.find('libparts').find_all('libpart'):
AttributeError: 'NoneType' object has no attribute 'find_all'

C:\Python27\Scripts>

TypeError in Ubuntu 14.04

Hello,

I generate a BOM with bom2csv plugin. This generates a valid xls file.
I run kicost with

$ kicost -i test.xml -d 2

and the output is:

Get schematic XML... Get parts library... Get components... Get groups of identical components... Get parsed product page for each component group... newark ['R4', 'R5', 'R1', 'R2', 'R3'] Traceback (most recent call last): File "/usr/local/bin/kicost", line 9, in <module> load_entry_point('kicost==0.1.12', 'console_scripts', 'kicost')() File "/usr/local/lib/python2.7/dist-packages/kicost-0.1.12-py2.7.egg/kicost/__main__.py", line 80, in main kicost(in_file=args.input, out_filename=args.output, debug_level=args.debug) File "/usr/local/lib/python2.7/dist-packages/kicost-0.1.12-py2.7.egg/kicost/kicost.py", line 100, in kicost list(distributors.keys()), part) File "/usr/local/lib/python2.7/dist-packages/kicost-0.1.12-py2.7.egg/kicost/kicost.py", line 1198, in get_part_html_trees fields['manf#']) File "/usr/local/lib/python2.7/dist-packages/kicost-0.1.12-py2.7.egg/kicost/kicost.py", line 1456, in get_newark_part_html_tree tree = BeautifulSoup(html, 'lxml') File "build/bdist.linux-x86_64/egg/bs4/__init__.py", line 212, in __init__ File "build/bdist.linux-x86_64/egg/bs4/builder/_lxml.py", line 109, in prepare_markup File "build/bdist.linux-x86_64/egg/bs4/dammit.py", line 263, in encodings File "build/bdist.linux-x86_64/egg/bs4/dammit.py", line 33, in chardet_dammit File "/usr/lib/python2.7/dist-packages/chardet/__init__.py", line 24, in detect u.feed(aBuf) File "/usr/lib/python2.7/dist-packages/chardet/universaldetector.py", line 115, in feed if prober.feed(aBuf) == constants.eFoundIt: File "/usr/lib/python2.7/dist-packages/chardet/charsetgroupprober.py", line 59, in feed st = prober.feed(aBuf) File "/usr/lib/python2.7/dist-packages/chardet/utf8prober.py", line 52, in feed codingState = self._mCodingSM.next_state(c) File "/usr/lib/python2.7/dist-packages/chardet/codingstatemachine.py", line 43, in next_state byteCls = self._mModel['classTable'][ord(c)] TypeError: ord() expected string of length 1, but int found

Using Python 2.7 and installed with easy_install kicost

KeyError: u'manf#' at kicost.py 316 (version 0.1.14)

I updated to latest and now program fails with following traceback:

Traceback (most recent call last):
  File "/home/vovan/.local/bin/kicost", line 9, in <module>
    load_entry_point('kicost==0.1.14', 'console_scripts', 'kicost')()
  File "/home/vovan/.local/lib/python2.7/site-packages/kicost-0.1.14-py2.7.egg/kicost/__main__.py", line 94, in main
    kicost(in_file=args.input, out_filename=args.output, serial=args.serial, debug_level=args.debug)
  File "/home/vovan/.local/lib/python2.7/site-packages/kicost-0.1.14-py2.7.egg/kicost/kicost.py", line 115, in kicost
    parts = get_part_groups(in_file)
  File "/home/vovan/.local/lib/python2.7/site-packages/kicost-0.1.14-py2.7.egg/kicost/kicost.py", line 316, in get_part_groups
    if components[ref]['manf#'] == manf_num:
KeyError: u'manf#'
zsh: exit 1     kicost -i testproject.xml

My fix:

--- kicost.py.old   2016-01-10 10:07:03.942035863 +0300
+++ kicost.py   2016-01-10 10:07:10.646094619 +0300
@@ -313,7 +313,7 @@
             sub_group.manf_nums = [manf_num]
             sub_group.refs = []
             for ref in grp.refs:
-                if components[ref]['manf#'] == manf_num:
+                if 'manf#' in components[ref] and components[ref]['manf#'] == manf_num:
                     sub_group.refs.append(ref)
             new_component_groups.append(sub_group)

Support for Jameco vendor

I just started using kicost, but really like it already.

I also source some of my parts from Jameco, (www.jameco.com) would it be possible to use them with kicost? I'm not afraid of coding, and would be glad to help where needed.

Display "extra" component data by the distributor

For "extra data" information, xlsx could display some distributor site return data (value, tolerance, footprint/package, etc) which doesn't necessarily care about a match to the component data. Although maybe cares about consistency or a fuzzy match between distributors (mouser, digikey, Newark)

Which, if doing that, begs for a template file (text file) to setup which fields to display as "extra data". Maybe instead of relying on fuzzy matching to have the setup file also prioritize which site "wins" if information exists. Example: setup file wants two "extra data" fields and perhaps denotes them as:

$extra1=mouser,"tolerance",digikey,"tolerances",Newark,"tol:";$extra2=digikey,"package"

Example shows two extra fields. First field will fill in with a match on part html line with "tolerance" match. If no match, then try Digikey a match for "tolerances" (showing maybe different search strings for different distributors), if no match then try Newark a line with "tol:". The 2nd extra field only matches if digikey returns a field with "package". How the script decides what the value is to return (presumably data to the right of the search string) - how much to return (and when to terminate) may not be worth deciding so there may need to be a third field which tells the script how to determine. $extra1=mouser,"tolerance","regex? Something else",digikey,"tolerances","dk value parse helper", Newark."tol:."newark parser helper"

Not settled on the parser helper field - but that it could help the script abstract how to determine the value return format.

All Prices 0 in spreadsheet

Hello, I like your project. However, I am getting all pricing information coming back as 0.00. All the links are correct and it seems to scrape correctly. It just doesn't seem to put the prices back into the worksheet. Any ideas what I could be doing wrong?

Edit: It appears the formula used just doesn't work on libre office calc

installing kicost

Hi All,
When i run a command "$ easy_install kicost" or 'pip install kicost' to install kicost it shows syntax error in command line.

I am very new to python. So some one guide me in solving this problem.

Regards,
Arun

Problem "List index out of range"

HI,

I get a problem "List index out of range" in python.
untitled

Description:
KiCost 0.1.32
Win7 32-bit
Python 2.7

Any suggestions? Thanks

Out of stock part selected

manf# = 5505207F
the script selects this part from mouser even though it isn't in stock. Digikey has it in stock and it gets a price for it... it just doesn't correctly highlight it as the least cost part.

BOM unit cost break price ( by qty of 10, 100, 1k, 3k ...)

I propose the following improvement: the creation of an extra tab, in the output spreadsheet file, plotting economic production/order quantity: 100 , 500, 1k, 3k ...
It would greatly help builder to decide the batch size with a nice curve of price per unit and total investment.

Show unit price

Have a default calculator for price per unit based on the quantity pricing. I'm putting a formula =$I$2/$I$1 mess of "$" only so it sticks absolute if I move it around) in cell J2 right next to the total cost. I guess it would make most sense in I2 with I3 as total cost so it looks like "top line times next line equals next line which is total cost". It's not a big deal to add the formula - but I like to communicate the "how much is one of these things going to cost if we build X amount" up to management so I always look at the /u cost of a large order.

Progress bar

Add a progress bar to indicate the percentage of the web scraping that's been completed.

Kicost for larger xml files

Hi All,

Kicost is unable to process bigger XML files size say above 100kb.
Can anyone give some suggestion?

Or at least i need to generate proper BOM from saxonica.
At present it is generating as one component per line.
But i need as kicost format, means it should be grouped.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.