Extension C module

vmarkwart at my-deja.com vmarkwart at my-deja.com
Sun Mar 5 23:15:10 EST 2000


Hi,
A couple of strange things. The extension module I'm (attempting) to
write (Borland's C++ Builder 4) has a couple of little flaws.

When I include
  Py_INCREF(Py_None);
  return Py_None;
in a procedure which returns no value, it compiles correctly but
returns a memory exception error when imported and run, and crashes
Python (not a happy sight). When I leave those lines out and return an
empty string the function can be called happily from Python, but
returns an unloved, unwanted empty string. Any ideas on what I'm doing
wrong.?

Also, I have another function which returns a dictionary of values, eg
>>> import pytools
>>> pytools.volumeInfo("f:\\")
{'filenameUnicode': 'supported', 'filenameMaxLength': '255',
'volumeName': 'SYS', 'filenameCase': 'preserved', 'volumeCompression':
'compressed', 'filenameCompression': 'supported', 'volumeSerialNumber':
'1628725518', 'filesystemName': 'NWFS', 'filenameCaseSensitivity':
'caseSensitive', 'filesystemACLs': 'supported'}

In interactive mode everything looks fine, but when run in a script it
comes back with the error:
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "pytoolstest.py", line 32, in ?
    vinfo = pytools.volumeInfo(drive)
TypeError: argument 1: expected string without null bytes, string found

Any clues as to where to start looking? I've commented out virtually
everything in the function, and I still get the error.

If anyone wants the sourcecode, please email me at
vmarkwart at hotmail.com
Cheers
Victor


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list