Issue37016
Created on 2019-05-22 21:45 by mohantys, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| PYTHON_PROJ.cpp | mohantys, 2019-05-22 21:45 | C++ file calling function in python file | ||
| Messages (3) | |||
|---|---|---|---|
| msg343246 - (view) | Author: Soumya Mohanty (mohantys) | Date: 2019-05-22 21:45 | |
Hello,
I am trying to open a pickled file and load it in my python file.
This python file will be called from a c++ program. Please find the C++ program attached.
Py_Initialize and Py_Finalize are being done in a separate file called pyhelper.hpp
Python code :
def test():
print("In function test of pyemb.py file \n")
import pickle
with open('filepath', 'rb') as f_in:
C = pickle.load(f_in)
I am getting the following error and cant find any way to fix it:
Exception ignored in: <module 'threading' from 'C:\\Anaconda3\\envs\\Deep_Learning\\lib\\threading.py'>
Traceback (most recent call last):
File "C:\Anaconda3\envs\Deep_Learning\lib\threading.py", line 1289, in _shutdown
assert tlock.locked()
SystemError: <built-in method locked of _thread.lock object at 0x000002328D1EAAA8> returned a result with an error set
|
|||
| msg343281 - (view) | Author: Stéphane Wirtel (matrixise) * ![]() |
Date: 2019-05-23 07:57 | |
Hi Soumya, But Py_Initialize and Py_Finalize are not called in this case, and it's not a bug of CPython. I suggest you read this link: https://docs.python.org/3/extending/embedding.html#very-high-level-embedding Thank you |
|||
| msg343296 - (view) | Author: Soumya Mohanty (mohantys) | Date: 2019-05-23 13:47 | |
Hello Stéphane, I appreciate the reply, but read the docs and they did not resolve my problem. I solved it by adding full paths to the file instead of just there names, even though the file being loaded was in the present working directory and when working in pure python it works. I would like to know what exactly is causing this issue, but we can close the issue (As it is not a bug) |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:15 | admin | set | github: 81197 |
| 2019-05-23 13:47:17 | mohantys | set | messages: + msg343296 |
| 2019-05-23 07:57:18 | matrixise | set | status: open -> closed nosy:
+ matrixise resolution: not a bug |
| 2019-05-22 21:45:30 | mohantys | create | |
