Extension C module

vmarkwart at my-deja.com vmarkwart at my-deja.com
Mon Mar 6 05:15:10 CET 2000

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
  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

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

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

More information about the Python-list mailing list