On Thursday, September 6, 2012 4:21:56 PM UTC-4, Tim Williams wrote: > On Thursday, September 6, 2012 11:07:07 AM UTC-4, Helpful person wrote: > > > I am a complete novice to Python. I wish to access a dll that has > > > > > > been written to be compatible with C and VB6. I have been told that > > > > > > after running Python I should enter "from ctypes import *" which > > > > > > allows Python to recognize the dll structure. I have placed the dll > > > > > > into my active directory (if that's the correct word, one on my path) > > > > > > for simplification. > > > > > > > > > > > > I tried: "import name.dll" but this just gave me an error telling me > > > > > > that there was no such module. > > > > > > > > > > > > Can someone please help? > > > > > > > > > > > > Richard > > > > I'm new to using the ctypes module also, but what I did to find the library > was I appended the location of the dll to my PATH like so: (this is Windows) > > > > pth = os.environ['path'].split(';') > > pth.append(os.path.join(os.environ['userprofile'],'My Documents','DLLs')) > > os.environ['path'] = ';'.join(pth)
I should have also mentioned to look at LoadLibrary in the ctypes module. e.g. mylib=cdll.LoadLibrary('mylib.dll') -- http://mail.python.org/mailman/listinfo/python-list