[New-bugs-announce] [issue43342] Error while using Python C API
Piyush Patel
report at bugs.python.org
Sat Feb 27 14:08:59 EST 2021
New submission from Piyush Patel <piyush.428ec at gmail.com>:
Hi,
I am facing a very strange issue.
I am working on a C++ application which embeds a python.
As per documentation i have the dependencies added from python (/libs and /include directories) to C++ application.
I am using Py_RunString() to run simple python code.
Python code is simple:
import os
def Func():
return 10.0
The application run smoothly when i have python installation in directory like
"C:\PythonXY\"
but if python installation is in directory like "C:\MyPython\" or default installation path AppData\local\program\python\pythonxy\ , python code errors out.
the error i am getting is "__import__ not found".
I have used PyErr_Fetch to retrieve error.
It's really strange that the python installation directory affects how Python code is run.
It seems it have a problem running "import os" statement or any "import" statement.
Could you help me how i can resolve this issue?
Thanks,
Piyush
----------
components: C API
messages: 387783
nosy: piyush115
priority: normal
severity: normal
status: open
title: Error while using Python C API
type: compile error
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43342>
_______________________________________
More information about the New-bugs-announce
mailing list