[Tutor] ctypes question

Albert-Jan Roskam fomcl at yahoo.com
Tue Mar 8 13:23:20 CET 2011


Hi Joel,

I found this on stackoverflow*)
os.environ['PATH'] = os.path.dirname(__file__) + ';' + os.environ['PATH']
windll.LoadLibrary('mydll.dll')

It extends the directory list of the environment variable 'path'.

Now at least I've loaded the dll, but I still need to read up on ctypes an file 
handles. 

Any good pointers (no pun intended ;-) are welcome!

 *) 
http://stackoverflow.com/questions/2980479/python-ctypes-loading-dll-from-from-a-relative-path


Cheers!!
Albert-Jan


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public 
order, irrigation, roads, a fresh water system, and public health, what have the 
Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




________________________________
From: Joel Goldstick <joel.goldstick at gmail.com>
To: tutor at python.org
Sent: Tue, March 8, 2011 12:14:45 PM
Subject: Re: [Tutor] ctypes question




On Tue, Mar 8, 2011 at 4:09 AM, ALAN GAULD <alan.gauld at btinternet.com> wrote:

> When I use os.chdir (by the way: why on earth isn't this called os.setcwd()?? 
>> That's consistent with os.getcwd()) 
>
>History.
>They are Unix commands (and possibly Multics/PDP before that!).
>cd has been the command in almost every CLI OS I've ever used from 
>CP/M thru' OS/9, Unix, DOS,  etc...
>
>The only exceptions being VAX/VMS(uses 'set def') and OS/390 on 
>a mainframe which doesn't use a directory based file system.
>
>That doesn't mean Python shouldn't adopt a more consistent naming 
>scheme it's just that the folks building it simply transferred the names 
>of the commands that they were familiar with. Its a self perpetuating
>habit... :-)
>
>Alan G.
>
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>To unsubscribe or change subscription options:
>http://mail.python.org/mailman/listinfo/tutor
>
>
I'm glad to see you got the result you wanted.  But, by moving your current 
working directory to the library's directory seems like it could cause other 
problems with the code.  I don't do python on windows, and have unremembered a 
lot I used to know about windows.  So, my question is, isn't there another way 
to do this?

-- 
Joel Goldstick


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110308/68e38a24/attachment.html>


More information about the Tutor mailing list