I've been working the last couple of weeks on a image downloader from the site mangareader and I've finally done the main code, except from a small bug, which makes the first image to save itself outside the folder the code creates to save them all. Here's an example: http://i.stack.imgur.com/fUpg8.png
I can't figure out why it works this way, since the code seemed to be working just fine. Here's the function that makes the folder change:
def pathchange(old, new):
if os.path.exists(new):
os.chdir(new)
else:
os.mkdir(new)
And here is the download function: http://pastebin.com/FfuxirvK
Thanks beforehand for your help.