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.