pycache directories

M

monosij.forums

I am doing some OO python3 where I am using multiple dirs/sub-dirs.

So everything works fine, however when I run code __pycache__ directories are being created in every directory touched by the execution.

Is it possible to set a configuration to be able to create these pycache directories in a specific location?

Coming from the Java world - am used to the /src, /bin aspects - so somewhat prefer the 'executables' out of the way.

I am using python3 on Ubuntu so wondering if there is some environ setting?

Thanks for your help.
 
T

Terry Reedy

I am doing some OO python3 where I am using multiple dirs/sub-dirs.

So everything works fine, however when I run code __pycache__
directories are being created in every directory touched by the
execution.

This is much better than having multiple .pyc files in every directory,
as in Py2. You should soon learn to ignore them.
Is it possible to set a configuration to be able to create these
pycache directories in a specific location?

No. (I am very sure.) You can however, not have the .pyc files written,
but that means recompile with every run. So that option is meant for
running off a read-only medium.
 
M

monosij.forums

This is much better than having multiple .pyc files in every directory,

as in Py2. You should soon learn to ignore them.







No. (I am very sure.) You can however, not have the .pyc files written,

but that means recompile with every run. So that option is meant for

running off a read-only medium.

Thanks Terry. I understand needing to adjust.
Appreciate this forum.

Monosij
 
M

monosij.forums

This is much better than having multiple .pyc files in every directory,

as in Py2. You should soon learn to ignore them.







No. (I am very sure.) You can however, not have the .pyc files written,

but that means recompile with every run. So that option is meant for

running off a read-only medium.

Thanks Terry. I understand needing to adjust.
Appreciate this forum.

Monosij
 
J

jorvis

I agree, this would be a good feature. I redirect my emacs backups to a single directory too so that they're not distributed all over the file system.. While I don't know how to do that with the things python creates, I've read a few ways you can disable their creation altogether (assuming you don't care or need the benefit of their use):

You can run python with -B or set the environmental variable PYTHONDONTWRITEBYTECODE=1

For fun, lots of developer discussion about its original creation here:

http://www.gossamer-threads.com/lists/python/dev/815510
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top