|
From: Adam N. <a.n...@sh...> - 2011-03-14 05:33:10
|
Hi all,
I've just discovered that an enum value buried in one of the classes I am
trying to wrap is called None, which conflicts with the Python constant None:
class MyClass {
enum Attributes {
None = 0x00,
...
};
};
Wrapping the class with SWIG normally produces this code in the .py file:
None = _modulename.MyClass_None
Which makes Python say:
SyntaxError: assignment to None
I thought I could get around this by simply renaming that value like so:
%rename(None2) ns::MyClass::None;
However that produces this in the .py file:
None2 = _modulename.MyClass_None2
Resulting in:
AttributeError: 'module' object has no attribute 'MyClass_None2'
It would seem that I want to rename the first None (on the LHS) but not the
one on the RHS.
Does anyone know how this is achieved?
Many thanks,
Adam.
|