Hi Adrian, Thanks for the quick reply. I am running this only in one version of python. Python version 2.7.6. I using SPYDER 2.2.5 that came with python(x,y) version 2.7.6.1. My operating system is windows 7, 64bit. I didn't run this code on different version of python.
The goal of this script is just to create 100 new folders. I also import: from brian import * from numpy import * Do you think it has something there that interfere with SPYDER? As I mentioned before, SPYDER manages to create 100 folders ONLY if I copy the code to the console. SPYDER creates just 4 folders when I run the code in a new dedicated python interpreter. Try to run the code (with the additional imports) and see for yourself. I can work with this bug, but it is not very convenient. Best, Gilad On Wed, Aug 13, 2014 at 5:33 PM, Adrian Klaver <[email protected]> wrote: > I sent this to list, but it seems the list is slow, so here is a copy/ > > > -------- Original Message -------- > Subject: Re: [spyder] A bug in SPYDER: unable to create new folders within > a for loop > Date: Wed, 13 Aug 2014 06:58:27 -0700 > From: Adrian Klaver <[email protected]> > To: [email protected] > > On 08/13/2014 03:52 AM, Gilad Cohen wrote: > >> Hi, >> >> I found a bug in SPYDER when trying to create new folders within two >> "for loops". >> My code is: >> >> >> import os >> >> path=os.getcwd() >> >> for modularity in xrange(0,26): >> >> m=modularity/100 >> >> for part in xrange(1,5): >> >> os.chdir(path) >> >> exec("new_folder = '\mod%s_part%s'" % (m,part)) >> >> new_path=path + new_folder >> >> if not os.path.exists(new_path): >> >> os.makedirs(new_path) >> >> os.chdir(new_path) >> >> >> >> If I copy this to the console, the code works just fine, it creates 100 >> (25*4) new folders. >> >> However, if I run this code in a new dedicated python interpreter, only >> 4 new folders are created. >> >> Can anyone else verify this bug? I am using Spyder 2.2.5 that came with >> my python(x,y) version 2.7.6.1. >> > > Are you running this in different versions of Python? > > Or is there more to this code? > > Because: > > for modularity in xrange(0,26): > m=modularity/100 > print m, modularity > > 0 0 > 0 1 > 0 2 > 0 3 > 0 4 > 0 5 > 0 6 > 0 7 > 0 8 > 0 9 > 0 10 > 0 11 > 0 12 > 0 13 > 0 14 > 0 15 > 0 16 > 0 17 > 0 18 > 0 19 > 0 20 > 0 21 > 0 22 > 0 23 > 0 24 > 0 25 > > Seems you are dealing with integer division. So either the case that > works is running in Python 3+ or you are doing a from __future__ import > division somewhere. > > >> >> Best, >> >> GIlad >> >> > > -- > Adrian Klaver > [email protected] > > > -- You received this message because you are subscribed to the Google Groups "spyder" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/spyderlib. For more options, visit https://groups.google.com/d/optout.
