Re: [Tutor] ctypes question

2012-10-10 Thread Albert-Jan Roskam
- Original Message - > From: eryksun > To: Albert-Jan Roskam > Cc: Python Mailing List > Sent: Wednesday, October 10, 2012 1:40 PM > Subject: Re: [Tutor] ctypes question > > On Wed, Oct 10, 2012 at 6:02 AM, Albert-Jan Roskam > wrote: >> >> el

Re: [Tutor] ctypes question

2012-10-10 Thread eryksun
On Wed, Oct 10, 2012 at 6:02 AM, Albert-Jan Roskam wrote: > > elif pf.startswith("lin"): > libc = ctypes.CDLL("libc.so.6") > fopen = libc.fdopen > fh = fopen(ctypes.c_char_p(fn), "rb") > fhPtr = ctypes.byref(ctypes.c_int(fh)) > buff = ctypes.create_string_buffer(lines) > ret = libc.fread(

Re: [Tutor] ctypes question

2012-10-10 Thread Alan Gauld
On 10/10/12 11:02, Albert-Jan Roskam wrote: I have a program that reads and writes files using ctypes. Any particular reason why? That's not normally something I'd expect you to need ctypes for. Unless you just want to play with ctypes... When I want it to read AND write (e.g. read a file,

Re: [Tutor] ctypes question

2012-10-10 Thread Peter Otten
Albert-Jan Roskam wrote: > I have a program that reads and writes files using ctypes. When I want it > to read AND write (e.g. read a file, select some stuff and write that), > the library returns a 'read-open' error. I think that the pointer to the > file handle for read and write point to the sa

[Tutor] ctypes question

2012-10-10 Thread Albert-Jan Roskam
Hi,   I have a program that reads and writes files using ctypes. When I want it to read AND write (e.g. read a file, select some stuff and write that), the library returns a 'read-open' error. I think that the pointer to the file handle for read and write point to the same address. To test that

Re: [Tutor] ctypes question

2011-03-08 Thread Albert-Jan Roskam
From: Joel Goldstick To: tutor@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 wrote: > When I use os.chdir (by the way: why on earth isn't this called os.setcwd()?? >> That's consi

Re: [Tutor] ctypes question

2011-03-08 Thread Joel Goldstick
On Tue, Mar 8, 2011 at 4:09 AM, ALAN GAULD 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

Re: [Tutor] ctypes question

2011-03-08 Thread ALAN GAULD
> 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...

Re: [Tutor] ctypes question

2011-03-08 Thread Albert-Jan Roskam
__', '__weakref__', '_handle', '_name'] >>> 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? ~~~

Re: [Tutor] ctypes question

2011-03-07 Thread Alan Gauld
"Pacific Morrowind" wrote but that path doesn't actually exist... replace that path with either r"d:/temp/spssio32.dll" or with "d://temp//spssio32.dll"; otherwise the /t will be transformed into a tab. You've got your / and \ mixed up. Forward slashes (/) are fine in Windows paths. It's

Re: [Tutor] ctypes question

2011-03-07 Thread Joel Goldstick
On Mon, Mar 7, 2011 at 10:36 AM, Pacific Morrowind < pacificmorrow...@gmail.com> wrote: > Hi > > > On 07/03/2011 7:02 AM, Albert-Jan Roskam wrote: > > Hi, > > I want to use a dll to read Spss data files. But when I use > lib = ctypes.cdll.LoadLibary("d:/temp/spssio32.dll") > I get a WindowsError

Re: [Tutor] ctypes question

2011-03-07 Thread Pacific Morrowind
Hi On 07/03/2011 7:02 AM, Albert-Jan Roskam wrote: Hi, I want to use a dll to read Spss data files. But when I use lib = ctypes.cdll.LoadLibary("d:/temp/spssio32.dll") I get a WindowsError (cannot find module), even though the path exists. Why is that? Do I need to extend some environment varia

[Tutor] ctypes question

2011-03-07 Thread Albert-Jan Roskam
Hi, I want to use a dll to read Spss data files. But when I use lib = ctypes.cdll.LoadLibary("d:/temp/spssio32.dll") I get a WindowsError (cannot find module), even though the path exists. Why is that? Do I need to extend some environment variable (add another dir)? I am using Python 2.5 on Win