Re: leftover pyc files

2011-11-04 Thread Steven D'Aprano
On Fri, 04 Nov 2011 16:01:14 -0400, Terry Reedy wrote: > For those not aware, the compiled file caching and import system was > changed for 3.2. Given test.py, the compiled file is no longer test.pyc, > in the same directory, but (for cpython32) > __pycache__/test.cpython-32.pyc. Given the stateme

Re: leftover pyc files

2011-11-04 Thread Terry Reedy
For those not aware, the compiled file caching and import system was changed for 3.2. Given test.py, the compiled file is no longer test.pyc, in the same directory, but (for cpython32) __pycache__/test.cpython-32.pyc. Given the statement 'import test', the __pycache__ directory is only searched

Re: leftover pyc files

2011-11-04 Thread 88888 Dihedral
Uhn, thanks for the easy way Just delete all *.pyc recursively. spend another 5-20 minutes to recompile all to get everything sync.. That is trivial! -- http://mail.python.org/mailman/listinfo/python-list

Re: leftover pyc files

2011-11-04 Thread Andrea Crotti
On 11/04/2011 10:39 AM, Chris Angelico wrote: If you're removing them all, you don't need to use a powerful shell. Much much easier! Just recursively del *.pyc and you're done. ChrisA Discussing with the guy that did it I think it's actually a good idea instead, because removing them *all* me

Re: leftover pyc files

2011-11-04 Thread Chris Angelico
On Fri, Nov 4, 2011 at 9:34 PM, Andrea Crotti wrote: > Uhm yes it makes sense also to just remove all of them, I don't know why it > was done like this but > probably for "performance" reasons. > > I will try both ways, but I would definitively avoid the shell scripting, > because it's mainly wind

Re: leftover pyc files

2011-11-04 Thread Andrea Crotti
On 11/04/2011 09:27 AM, Jonathan Hartley wrote: I like to install a Bash shell of some kind on windows boxes I work on, specifically so I can use shell commands like this, just like on any other operating system. Cywin works just fine for this. svn also has hooks, but sadly not a checkout hook

Re: leftover pyc files

2011-11-04 Thread Jonathan Hartley
Apologies for all my messasges appearing twice. I'm using google groups web ui and have no idea why it's doing that. I'll stop using it. -- http://mail.python.org/mailman/listinfo/python-list

Re: leftover pyc files

2011-11-04 Thread Jonathan Hartley
I like to install a Bash shell of some kind on windows boxes I work on, specifically so I can use shell commands like this, just like on any other operating system. Cywin works just fine for this. svn also has hooks, but sadly not a checkout hook: http://svnbook.red-bean.com/en/1.1/ch05s02.html

Re: leftover pyc files

2011-11-03 Thread Steven D'Aprano
On Thu, 03 Nov 2011 17:54:52 +, Andrea Crotti wrote: > All these ideas (shell and git hooks) are nice, but unfortunately - it's > svn not git > - it's windows not *nix > - we have to remove only the ones without the corresponding *py... Does it matter? The other .pyc files will be recreated w

Re: leftover pyc files

2011-11-03 Thread David Robinow
On Thu, Nov 3, 2011 at 1:54 PM, Andrea Crotti wrote: > All these ideas (shell and git hooks) are nice, but unfortunately > - it's svn not git > - it's windows not *nix > - we have to remove only the ones without the corresponding *py... > -- > http://mail.python.org/mailman/listinfo/python-list >

Re: leftover pyc files

2011-11-03 Thread Chris Angelico
On Fri, Nov 4, 2011 at 4:54 AM, Andrea Crotti wrote: > All these ideas (shell and git hooks) are nice, but unfortunately > - it's svn not git > - it's windows not *nix > - we have to remove only the ones without the corresponding *py... Windows? Well, Windows shell scripting isn't quite as rich a

Re: leftover pyc files

2011-11-03 Thread Andrea Crotti
All these ideas (shell and git hooks) are nice, but unfortunately - it's svn not git - it's windows not *nix - we have to remove only the ones without the corresponding *py... -- http://mail.python.org/mailman/listinfo/python-list

Re: leftover pyc files

2011-11-03 Thread Peter Otten
Jonathan Hartley wrote: > A task like this is more suited to bash than Python: > > find . -name '*.pyc' -exec rm '{}' ';' You forgot to exclude the .svn directory from the search and didn't limit the deletion to pyc-files whose corresponding py-file doesn't exist. How would your line look with

Re: leftover pyc files

2011-11-03 Thread Jonathan Hartley
This can be added to your project's .git/hooks/post-checkout: #!/usr/bin/env bash cd ./$(git rev-parse --show-cdup) find . -name '*.pyc' -exec rm '{}' ';' -- http://mail.python.org/mailman/listinfo/python-list

Re: leftover pyc files

2011-11-03 Thread Jonathan Hartley
This can be added to git as a post-checkout hook: In your project's .git/hooks/post-checkout: #!/usr/bin/env bash cd ./$(git rev-parse --show-cdup) find . -name '*.pyc' -exec rm '{}' ';' -- http://mail.python.org/mailman/listinfo/python-list

Re: leftover pyc files

2011-11-03 Thread Jonathan Hartley
A task like this is more suited to bash than Python: find . -name '*.pyc' -exec rm '{}' ';' -- http://mail.python.org/mailman/listinfo/python-list

Re: leftover pyc files

2011-11-02 Thread Andrea Crotti
On 11/02/2011 04:06 PM, Chris Kaynor wrote: If you can at least upgrade to Python 2.6, another option, if you don't mind losing the byte code caching all together (it may worsen load times, however probably not significantly), you can set PYTHONDONTWRITEBYTECODE to prevent the writing of .pyc fil

Re: leftover pyc files

2011-11-02 Thread Chris Kaynor
If you can at least upgrade to Python 2.6, another option, if you don't mind losing the byte code caching all together (it may worsen load times, however probably not significantly), you can set PYTHONDONTWRITEBYTECODE to prevent the writing of .pyc files. Alternatively, again in 2.6+, you can also

Re: leftover pyc files

2011-11-02 Thread Andrea Crotti
On 11/02/2011 03:03 PM, Peter Otten wrote: Switch to Python3.2 ;) Yes I saw that and it would be great, unfortunately we're stuck with Python 2.5 :O for some more time. Anyway now the code that does it is a recursive thing ilke def _clean_orphaned_pycs(self, directory, simulate=False): "

Re: leftover pyc files

2011-11-02 Thread Peter Otten
Andrea Crotti wrote: > In our current setup, the script in charge to run our applications also > scan all the directories and if it finds any "pyc" file without the > corresponding > module, it removes it. > > This was done because when you rename something, the old "pyc" remains > there and can

leftover pyc files

2011-11-02 Thread Andrea Crotti
In our current setup, the script in charge to run our applications also scan all the directories and if it finds any "pyc" file without the corresponding module, it removes it. This was done because when you rename something, the old "pyc" remains there and can cause problems. Is it the only w