Home > Back-end >  C call python error
C call python error

Time:10-23

C + + call python, write an example, but has been submitted to the PyImport_Import error,
Python folder structure is as follows
AA |
| -- A_1. Py
| -- A_2. Py

CC. Py
In CC. Py importAA modules folder, so in the CC. Py has written the following code:
The import OS
The import sys
Sys. Path. Append (OS) path) dirname (OS) path) realpath (__file__)))
Sys. Path. Append (OS) path) dirname (OS) path) realpath (__file__)) + "\ " AA)

The import A_1 as A1

C + + callback is CC. Py module,
PyString_FromString (" CC ");

Has been submitted to the PyImport_Import error, if the CC in the "import A_1 as A1", c + + can call succeeds,
See the introduction of the Internet, may be in the CC to import A_1 module can not find, but I have added to the path in the path of the AA, consult everybody a great god, and I'm supposed to do?


  • Related