[Tutor] ImportError: DLL load failed
Ajay
abra9823 at mail.usyd.edu.au
Mon Sep 27 15:36:47 CEST 2004
Quoting Gus Tabares <gustabares at verizon.net>:
>
> Did you try running the Python script from the command line? Usually it
> will
> tell you the DLL that you are missing.
the code i posted earlier, is the DLL that it cannot find. i compiled it to
a DLL and when i import it i get the DLL load failed error, even though the
path to is in sys.path
could it be because it can't find the OpenSSL dll's? i added the path to
\OpenSSL which contains the dll's, to my sys.path before i tried importing
my dll.
i really cant understand whats throwing the error. i have already run tests
on the OpenSSL dll's and they all work fine. my code built fine. so why
does import give an error?
>
>
> HTH,
> Gus
>
>
>
>
> On Monday 27 September 2004 03:43 am, Ajay wrote:
> > hi!
> >
> > I wrote a simple C code to work with OpenSSL and it builds fine.
> > however when i import it, i get an error
> > ImportError: DLL load failed. The specified module could not be found.
> >
> > the file is in Python/Lib directory.
> >
> > the code is below.
> >
> > thanks
> >
> > #include <Python.h>
> > #include "openssl/bio.h"
> > #include "openssl/ssl.h"
> > #include "openssl/err.h"
> >
> > static PyObject * start(PyObject *self, PyObject *args)
> > {
> > int x;
> > BIO * bio;
> > char buf[1024];
> > int len = 512;
> > SSL_load_error_strings();
> > ERR_load_BIO_strings();
> > OpenSSL_add_all_algorithms();
> > bio = BIO_new_connect("www.ibm.com:80");
> > if(bio==NULL)
> > {
> > //handle error
> > x = -5;
> > }
> > if(BIO_do_connect(bio) <= 0)
> > {
> > //handle failed connection
> > x = -4;
> > }
> > x = BIO_read(bio, buf, len);
> > if(x == 0)
> > {
> > //handle closed connection
> > x = -3;
> > }
> > else if(x<0)
> > {
> > if(! BIO_should_retry(bio))
> > {
> > //handle failed read
> > x = -2;
> > }
> > //do something to handle the retry
> > }
> > return Py_BuildValue("i", x);
> > }
> >
> > static PyMethodDef testSSLMethods[] = {
> > {"start", start, METH_VARARGS, "start and test SSL."},
> > {NULL, NULL, 0, NULL}
> > };
> >
> > PyMODINIT_FUNC
> > inittestSSL(void)
> > {
> > (void) Py_InitModule("testSSL", testSSLMethods);
> > }
> >
> > please help.
> >
> > thanks
> > cheers
> >
> >
> >
> >
> > ----------------------------------------------------------------
> > This message was sent using IMP, the Internet Messaging Program.
> > _______________________________________________
> > Tutor maillist - Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
>
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
More information about the Tutor
mailing list