I'm writing an application that loads byte-compiled *.pyc files under Python 3.3. I am distributing the *.pyc files without their corresponding *.py files to (try to) protect my source code. (Yes, as noted here, trying to deter decompilation by byte-compiling Python isn't the most secure option, but I can always add other code-security measures if I find I need to.)
However, I have found that Python isn't loading the *.pyc files without their original *.py files in place. (According to PEP 3147, the *.pyc files are kept in a subdirectory called __pycache__ in the directory where the *.py file would be. I am following this convention with my own code.)
Under an earlier iteration of my project that used Python 2.7, I byte-compiled the Python sources and placed the generated *.pyc files into the same directory as the *.py files; that worked just fine. Clearly, there is a problem with how Python is finding the __pycache__ folder. What am I doing wrong? (And yes, I have set sys.path appropriately; otherwise it would not be finding the *.py file when I insert it as a debugging measure.)