beeware / Python-Apple-support

A meta-package for building a version of Python that can be embedded into a macOS, iOS, tvOS or watchOS project.
MIT License
1.11k stars 161 forks source link

python: Can't reopen .pyc file #34

Closed hxhowl closed 3 years ago

hxhowl commented 6 years ago

I was used this framework in iOS,and can run python file with ".py",but I compile to ".pyc",it show a error:"python: Can't reopen .pyc file".I show the compile python version and python.framework are the same 3.5.4.

How can I solute this probrem? I run the file like thisPyRun_AnyFile(path, "hello.pyc");

thank you !

freakboy3742 commented 6 years ago

Are you using the pybee/Python-ios-template for your project? If so, the main.m file explicitly disables bytecode compilation, which may explain why a PYC file won't be executed. You may find that commenting out that line will help.

hxhowl commented 6 years ago

Then I try use ".py"file import function from ".pyc",it was work.But ,I run the c api PyRun_AnyFile(path, "hello.pyc");,it show this error.Is there something wrong with me?

I just want to add this frameworks in my app for support python,so I did not use pybee/Python-ios-template.

freakboy3742 commented 3 years ago

Closing due to lack of activity.