cython - What method can I use instead of __file__ in python? -


i convert python code c cython , after compile .c file , use .so in project. problem: use __file__ in python code , in while compile gcc, doesn't error. when run program , import .so in other python files, appear error __file__ line.

how can solve problem? there method replace __file__?

try add @ beginning of file:

import inspect if not hasattr(sys.modules[__name__], '__file__'):     __file__ = inspect.getfile(inspect.currentframe()) 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -