2

I'm trying to define a new python type object using the documentation found here https://docs.python.org/3/extending/newtypes.html. At the moment I am just following the basics section defining a new type with the same names as used in the documentation. I am then embedding the python interpreter within a simple application by calling PyImport_AppendInittab("noddy", &PyInit_noddy); followed by Py_Initialize(); and then I am running a simple python script using PyRun_SimpleString(script); where "script" is actually the following

import noddy
mytest = noddy.Noddy()

which is within the documentation as an example of creating an object of the new extended type. The problem I am having is that this produces an error

TypeError: cannot create 'noddy.Noddy' instances

What am I doing wrong here? I appreciate I have not provided any source code but I have simply copied the example from the documentation. I understand what each part is doing but I cannot find a problem. The module called noddy is created, the Noddy object is added so why can I not create a noddy.Noddy() object as stated in the documentation?

vvvvv
  • 25,404
  • 19
  • 49
  • 81
Geom3trik
  • 25
  • 4
  • I am having the same issue not even embedding or anything. – Jerome Jun 12 '16 at 05:04
  • In my case, I had not realized I needed to tweak include/pyconfig.h . (Using MinGW-w64 together with Python 3.4-amd64 from python.org). I used a version that MSYS managed to generate with ./configure – Jerome Jun 12 '16 at 09:18

0 Answers0