Hey guys i definitely getting crazy i want to force Python to handle a .pyo like a .py i got kodi xbmc forked and getting crazy
i already tried out and changed multiple lines and nothing changed? i linked them here:
const std::string ADDON_PYTHON_EXT = "*.py"; changed this line to *.pyo
return URIUtils::HasExtension(m_strPath, ".py"); changed this line to. .pyo
i thought that would be enough after compiling, still nothing happens when try to open a add-on
still python does not load .pyo files and does not handle them as .py
btw: i figured out deleting all .py files in the folder and just let the first loaded .py file there so 1 -> .py and the others are all .pyo the add-on works. but when deleting this firstly loaded .py and using this as a .pyo it fails. So what do i have to change that it always use .pyo
First UPDATE:
i tried it out, it does indeed work as a workaround Created a dummy -> include.py with just 1 line import service was enough.
But i want to fix this directly in kodi. in documentions "If there is a current pyc file, this is taken as the compiled version, so no compile step has to be taken before running the command. Otherwise the py file is read, the compiler has to compile it"
So easy said, execute .py if not available check if .pyo but i cannot find where to change / add this method i cannot find even the method right for the execution
Second Update: i added these lines in githublink to file
//pyoextension == script
std::string pyoextension = script;
//Check if the file does exist
if (!CFile::Exists(script, false))
{
//pyoextension append o to get -> .pyo
pyoextension = script + "o";
//Check if pyoextension exist -> .pyo
//if not nothing exist throw error
if (!CFile::Exists(pyoextension, false)){
CLog::Log(LOGERROR, "%s - Not executing non-existing script %s", __FUNCTION__, script.c_str());
return -1;
}
LanguageInvokerPtr invoker = GetLanguageInvoker(pyoextension);
return ExecuteAsync(pyoextension, invoker, addon, arguments);
}
LanguageInvokerPtr invoker = GetLanguageInvoker(script);
return ExecuteAsync(script, invoker, addon, arguments);
Checking if the the add-on does not exist as a .py file checking if the .pyo file is there, and execute that instead. But still the checking does work, but it still throws an error out that it cannot start the script