Hello,
I want to use an new library i downloaded e.g. chilkat library (http://www.chilkatsoft.com/python.asp), how do i do that ?

I tried to put on the beginning of my code:

__path__ = ["dir_with_chilkat_pyd"] 
require chilkat

but does'nt work.

What i want to run:
http://www.example-code.com/python/http_loginForm.asp

try

import chilkat

no does'nt work, i put all stuff in "C:\Python26\Lib".

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import chilkat
  File "C:\Python26\lib\chilkat.py", line 19, in <module>
    _chilkat = swig_import_helper()
  File "C:\Python26\lib\chilkat.py", line 15, in swig_import_helper
    _mod = imp.load_module('_chilkat', fp, pathname, description)
ImportError: DLL load failed: The specified module could not be found.

a _name module is usually a swig/boost C/C++ library. Here try to see if there's a setup.py in the downloaded archive and use python setup.py build and python setup.py install.

hi leegao,
no setup in there :(

That means you haven't installed/setup the module correctly. Why don't you try going to the source website and see if there are instructions for setup.

I did,
that where the only instructions:

1.
__path__ = ["dir_with_chilkat_pyd"]
2.
require chilkat

hmm nobody an idea?

Well if you install it manually, you need to put it into the C:\Python2X\Lib\site-packages directory in its own folder. Then in that site-packages folder, make a file called chilkat.pth, and in it, write only chilkat (which is the name of the folder for it in the site-packages directory). Hopefully after this, if you start up the interpreter and type import chilkat it should import like any other module.

I haven't ever used chilkat, but this is the generic way to install a regular package, if it doesn't come with its own setup.

Get the absolute path of the package and add it onto the python path

say abs_dir = '/root/downloads/package-name/'

Then at the start of your script, you need to do the following

from sys import path as PYTHONPATH
PYTHONPATH.append('/root/downloads/package-name')

If you're on windows, don't forget the escape the backslashes

(IE: when you see \, you need to change it to \\)

Alternatively you can just place it inside a folder that's already in the python path (IE: the python25 directory). If you're on Linux, try using whereis python25 and then place the package folder inside there, if you're on windows, just go with C:\Python25\

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.