Kicost is amazing tool, but for me it didn't work!

KiCost would require proper internationalization to use Euros instead of USD. I don’t have the expertise or interest to do that. I suppose you could also hack the web scrapers for each distributor to do that.

The web scraper for RS was written by someone else. I suppose the problem is that it can’t find the quantity pricing info on some of the RS web pages. The page formatting is not particularly uniform, so that’s not surprising.

Great time saver tool! Worked as soon I installed WinPython and also wxPython in Windows7.
I noticed it does not get results from Farnell when I use a manufacturer part number found @ Farnell … I get results from the rest of the distributors for the same part however. Anyone noticed that? Or it is me doing something wrong?

Hi @iahim67. Did you install by pip or easy_install using the pypi repository? (https://pypi.org/project/kicost/)
I propose you to install by the last code version on GitHub pip install -U git+https://github.com/xesscorp/KiCost.git (or replace manually the files), we have been fixed a lot of issues related with user experience and web distributors.
Soon this version will be automatically on pip.

If still not working, please open a issue in https://github.com/xesscorp/KiCost/issues

Hi @hildogjr, I installed by easy_install but I will try as you suggested and see how it works - thanks.
Do I need to unistall the KiCost version installed by easy_install first? Or just pip install -U git+https://github.com/xesscorp/KiCost.git?

No, the -U in pip install -U means upgrade. I never used easy_install. I think pip use easy_install internally and allow more (for example here, install from GitHub).

Let me know if worked. On Windows I already installed from Git, but on Python3, not in Py2.

I need to install git first … and learn how to use it :smiley:
image
Is it possible to change the files by hand? Which files do I need to replace in this case?

Yes, download the files here https://github.com/xesscorp/KiCost and replace the kicost folder on your Python directory (is exactly this that the command does).

I just did as you told me: replaced the kicost folder - nothing else.
There was a change as I noticed I had to install pycountry for kicost to work.
After installing pycountry I ran kicost but still no results from Farnell.
I expect kicost to find ERA6ARB102V at Farnell (ERA6ARB102V - SMD Chip Resistor, 1 kohm, ERA6A Series, 100 V, Metal Film, 0805) under the 1717624 ordering code.
Of course KiCost does find this resistor at Digikey, Mouser … etc. but I’m curious why Farnel does not work, as I have tried other resistors as well (or capacitors).
image

pycountry is used now (beta feature) to adjust the country of each site (only on Digikey for now). In the future the KiCost will get price in your currency, if possible.

Please, create a issue on https://github.com/xesscorp/KiCost/issues/ relating this.

OK @hildogjr, I would like to test Farnell with few more parts, then I will create an issue providing details and examples. Thank you so far!

Hi,

I installed Kicost in my ubuntu 18.04 with Python 2.7.15rc1 and installed wxPython by following the instructions here https://wxpython.org/blog/2017-08-17-builds-for-linux-with-pip/. But when I kicost from the terminal I am getting this error

You don't have the wxPython dependence to run the GUI interface. Run once of the follow commands in terminal to install them:
pip3 install -U wxPython # For Windows & macOS
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython # For Linux 16.04
Or download from last version from <https://wxpython.org/pages/downloads/>

@ramprasadajay
So you install kicost on python2, this text usually appear if you are trying to start the GUI without wxPython, please confirm me the 3 point:

Which command you use to call KiCost, it was just kicost without any additional parameter?

  1. On terminal:

python -c “import kicost” # Should import kicost library on Py2 without error.

If you got some error try

python3 -c “import kicost” # So, if this return without error and the previous one within, KiCost is on Py3, not Py2.

Do that same for wx:

python2 -c “import wx; print(wx.version())”
python3 -c “import wx; print(wx.version())”

Write here the outputs of (2) and (3).

Thanks for the reply

result for (2)

ajay@ajay-Lenovo-G500:~$ kicost
You don't have the wxPython dependence to run the GUI interface. Run once of the follow commands in terminal to install them:
pip3 install -U wxPython # For Windows & macOS
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython # For Linux 16.04
Or download from last version from <https://wxpython.org/pages/downloads/>
ajay@ajay-Lenovo-G500:~$ python -c “import kicost”
  File "<string>", line 1
    “import
    ^
SyntaxError: invalid syntax
ajay@ajay-Lenovo-G500:~$ python3 -c “import kicost”
  File "<string>", line 1
    “import
          ^
SyntaxError: invalid character in identifier

Result for (3)

ajay@ajay-Lenovo-G500:~$ python2 -c "import wx;print wx.__version__"
3.0.2.0
ajay@ajay-Lenovo-G500:~$ python3 -c "import wx;print wx.__version__"
  File "<string>", line 1
    import wx;print wx.__version__
                     ^
SyntaxError: invalid syntax

Inconclusive, I just discored now that the forum change the " when “have some word between that”. @ramprasadajay, you will have to type by your self (copy and past the command from here doesn’t help).

I don’t have much knowledge working with this commands @hildogjr.

No problem @ramprasadajay, the GUI is for your type of users.
Just type in your keyboard these commands (the forum here replaced the quote for an another character the is not the usual quote,but appear to be).
You will see, after try these (by typing) that some commands return no output. This means that they are Ok (and others not), so I will understand the problem in your installation (and pass the command to fix it).

python3 -c "import kicost" returned no error

python2 -c "import wx; print(wx.version())"
returned 3.0.2.0 gtk3 (classic)

and python3 -c "import wx; print(wx.version())" returned

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/wx/__init__.py", line 17, in <module>
    from wx.core import *
  File "/usr/local/lib/python3.6/dist-packages/wx/core.py", line 12, in <module>
    from ._core import *
ImportError: libpng12.so.0: cannot open shared object file: No such file or directory

So as you stated kicost is on Py3, not on Py2. and I assume wxPython is on Py2 and not on Py3. Is that the problem? @hildogjr

Perfectly, @ramprasadajay ! KiCad already install wxPython on python2. KiCost is made to work in both (python2 and 3), in few months the official support for python2 will end and also KiCad will change to Python 3.

To solve your problem, run:
sudo apt-get install python3-pip # If you don’t have yet the pip (maybe you already have).
sudo -H pip3 install -U pip # May be necessary to force a update of the “python3-pip”.
sudo -H pip3 install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython # For Linux 18.04

Even, if you would like to get the new code version of KiCost (we had solved some bugs), run:
sudo apt-get install git
sudo -H pip3 install -U git+https://github.com/xesscorp/KiCost
Or you can manually replace the files of KiCost installation by the kicost folder at the link above.

This new code version will be released in some days when we finish to improve more features.