<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt">Hi all,<br><br>Thanks for your replies. It wasn't a permissions issue. Apparently, not the full path name should be used. When I use os.chdir (by the way: why on earth isn't this called os.setcwd()?? That's consistent with os.getcwd()) and then use the file name only, it works. See the Idle session below. Thought it'd be nice to share this with you.<br><br>Best wishes,<br>Albert-Jan<br><br>Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32<br>&nbsp;&nbsp;&nbsp; <br>IDLE 1.2.4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&gt;&gt;&gt; import ctypes<br>&gt;&gt;&gt; lib = ctypes.cdll.LoadLibrary("d:/temp/spss_io/win32/spssio32.dll")<br><br>Traceback (most recent call last):<br>&nbsp; File "&lt;pyshell#1&gt;", line 1, in &lt;module&gt;<br>&nbsp;&nbsp;&nbsp; lib =
 ctypes.cdll.LoadLibrary("d:/temp/spss_io/win32/spssio32.dll")<br>&nbsp; File "C:\Python25\lib\ctypes\__init__.py", line 431, in LoadLibrary<br>&nbsp;&nbsp;&nbsp; return self._dlltype(name)<br>&nbsp; File "C:\Python25\lib\ctypes\__init__.py", line 348, in __init__<br>&nbsp;&nbsp;&nbsp; self._handle = _dlopen(self._name, mode)<br>WindowsError: [Error 126] Kan opgegeven module niet vinden<br>&gt;&gt;&gt; import os<br>&gt;&gt;&gt; os.path.exists("d:/temp/spss_io/win32/spssio32.dll")<br>True<br>&gt;&gt;&gt; os.chdir("d:/temp/spss_io/win32")<br>&gt;&gt;&gt; lib = ctypes.cdll.LoadLibrary("spssio32.dll")<br>&gt;&gt;&gt; dir(lib)<br>['_FuncPtr', '__class__', '__delattr__', '__dict__', '__doc__', '__getattr__', '__getattribute__', '__getitem__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__', '_handle', '_name']<br>&gt;&gt;&gt;
 <br><div>&nbsp;</div>Cheers!!<br>Albert-Jan<br><br><div>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>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?<br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<div><br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><div style="font-family: arial,helvetica,sans-serif; font-size: 13px;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Alan Gauld &lt;alan.gauld@btinternet.com&gt;<br><b><span style="font-weight: bold;">To:</span></b> tutor@python.org<br><b><span style="font-weight: bold;">Sent:</span></b> Mon, March 7, 2011 7:26:15 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [Tutor] ctypes question<br></font><br>
<br>"Pacific Morrowind" &lt;<a ymailto="mailto:pacificmorrowind@gmail.com" href="mailto:pacificmorrowind@gmail.com">pacificmorrowind@gmail.com</a>&gt; wrote<br><br>&gt; but that path doesn't actually exist... replace that path with either<br>&gt; r"d:/temp/spssio32.dll" or with "d://temp//spssio32.dll"; otherwise the<br>&gt; /t will be transformed into a tab.<br><br>You've got your / and \ mixed up.<br><br>Forward slashes (/) are fine in Windows paths. It's back<br>slashes(\) that need escaping or raw stringing. \t is tab...<br><br>On the original ask - could it be a permissions issue?<br>Does your app have acess to the file?<br><br>Alan G. <br><br>_______________________________________________<br>Tutor maillist&nbsp; -&nbsp; <a ymailto="mailto:Tutor@python.org" href="mailto:Tutor@python.org">Tutor@python.org</a><br>To unsubscribe or change subscription options:<br><span><a target="_blank"
 href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a></span><br></div></div></div>
</div><br>

      </body></html>