Is there any reason why a wxPython program would not generate a .pyc
file? I had this simple code, which is actually from the tutorial, that
won't generate a .pyc file. So the loading takes time whenever I ran
it.
Is there any reason why a wxPython program would not generate a .pyc
file? I had this simple code, which is actually from the tutorial, that
won't generate a .pyc file. So the loading takes time whenever I ran
it.
I'm using
Linux
Python 2.2
wxPython 2.3.2.1
wxGTK 2.3.2.1
First guess: Does the user who runs the code have write permission in the directory where the python file is located?
Are you aware that .pyc files are only created
when you do an import?
What happens if you manually import the program
from the python interpreter? Won't that create
a .pyc-file?
I'm not so sure you'll gain a lot in upstart time
with a .pyc-file though. You have a decent amount
of libraries to load. If it's a small program, the
byte code compilation will be rather fast.
···
At 23:01 2002-10-19 +0800, Alfredo P. Ricafort wrote:
Is there any reason why a wxPython program would not generate a .pyc
file? I had this simple code, which is actually from the tutorial, that
won't generate a .pyc file. So the loading takes time whenever I ran
it.
oops.... I just found out that you have be in an interactive mode to
generate a bytecode. I thought all along that a .pyc file will be
generated no matter which way you execute a python program.
···
On Sat, 2002-10-19 at 23:11, David C. Fox wrote:
Alfredo P. Ricafort wrote:
> Is there any reason why a wxPython program would not generate a .pyc
> file? I had this simple code, which is actually from the tutorial, that
> won't generate a .pyc file. So the loading takes time whenever I ran
> it.
>
> I'm using
>
> Linux
> Python 2.2
> wxPython 2.3.2.1
> wxGTK 2.3.2.1
>
First guess: Does the user who runs the code have write permission in
the directory where the python file is located?
No, it's not the interactive mode that matters.
.pyc-files are generated on import. If you run
a.py, and a.py has an "import b", a b.pyc will
be generated, unless there is already a b.pyc
with a more recent timestamp than b.py.
But as I said, you don't have a big speed gain
from having pre-compiled a small module if i has
to load a lot of modules anyway.
In general, building your application so that the
program file you run directly is fairly small, is
often a good idea.
···
At 23:40 2002-10-19 +0800, Alfredo P. Ricafort wrote:
oops.... I just found out that you have be in an interactive mode to
generate a bytecode. I thought all along that a .pyc file will be
generated no matter which way you execute a python program.