New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ipython generates .pyc
files even thought PYTHONDONTWRITEBYTECODE is set to 1 in Windows 10 and Ubuntu (Linux)
#11004
Comments
IPython doesn't do anything with bytecode directly - all your code is passed through to Python to be executed, so it's still Python considering that environment variable. One possibility is that Python on Windows checks for the environment variable when it starts, so setting it in the process doesn't affect anything. I guess you'd have to read the source code to be certain whether that's what's going on, though. |
Thanks for the points. I will try to figure out a solution and post it here so it may help others. I wrote down my test plan below.. and also had some questions. Would you know the answers to the highlight questions below? I understand that However, regardless of whether So my first plan is to get a repeatable test case first, where I can atleast generate the These are the tests I am thinking of
If these don’t, work my plan is to pretty much trigger a Q: As for digging into the |
Just wanted to update with my findings so far:
If there is a demand, I will check why Here are some experiments (folders) I ran. Each folder is a single experiment and has a README.txt with the experiment and the results details. These are primarily run on |
.pyc
files even thought PYTHONDONTWRITEBYTECODE is set to 1 in Windows 10.pyc
files even thought PYTHONDONTWRITEBYTECODE is set to 1 in Windows 10 and Ubuntu (Linux)
We don't set or read it at all, as far as I know. It's used by Python itself (which IPython runs on top of). |
I run
ipython
on both linux and windows. Recently I have had situations where my code has changed, but the bytecode doesn’t update or change. So I had to turn off the bytecode generation, otherwise debugging becomes a headache.I have set %env PYTHONDONTWRITEBYTECODE =1 in a file
00-startup.py
under.ipython>profile_default>startup
folder (https://stackoverflow.com/a/154617/4752883).In linux, setting
PYTHONDONTWRITEBYTECODE
seems to work fine for the last few days, in that it doesnt generate bytecode.On both linux and windows, I have checked using the
%env
magic parameter thatPYTHONDONTWRITEBYTECODE
is set correctly. However, ipython continues to generate bytecode in theipython
running under Windows 10.Does ipython not respect PYTHONDONTWRITEBYTECODE on Windows or Linux?
The text was updated successfully, but these errors were encountered: