mikeckennedy / python-jumpstart-course-demos

Contains all the "handout" materials for my Python Jumpstart by Building 10 Apps course. This includes try it yourself and finished versions of the 10 apps.
https://talkpython.fm/course
MIT License
746 stars 536 forks source link

LOLCat Factory, Windows #38

Closed golebiewsky closed 6 years ago

golebiewsky commented 6 years ago

Hi Mike,

Opening explorer in Windows won't actually work if your project is on different disk than C:

You can probably mitigate this, by changing directories with /d option before opening directory with explorer. I couldn't really find any explorer options to do this in one command. Maybe someone else will have some idea.

mikeckennedy commented 6 years ago

Hi @golebiewsky

This doesn't make any sense to me why this is happening. We are using the full path which should contain the drive as part of it in Windows. Can you do me a favor since my Windows 10 only has one drive? Can you just print out the arguments in the show cats?

elif platform.system() == 'Windows':
    print(['explorer', folder]) # <-- add this
    subprocess.call(['explorer', folder])
golebiewsky commented 6 years ago

Hi Mike,

I found the issue. My base_folder variable was: base_folder = os.path.dirname(file) instead of: base_folder = os.path.abspath(os.path.dirname(file))

And the path looked like this: D:/PROJEKTY/python/lolcat\cat_pictures instead of this: D:\PROJEKTY\python\lolcat\cat_pictures

I rewatched the video 'App 6: LOLCat Factory: LOLCat App on Windows' and you've skipped information about the change in this variable :) That's why I didn't notice it. At 00:05 mark you can see 'base_folder = os.path.dirname(file)' and at 02:04 it's already changed to 'base_folder = os.path.abspath(os.path.dirname(file))'

mikeckennedy commented 6 years ago

Ah, thanks @golebiewsky I think the reason that happened is originally what I had didn't work in Windows or Linux or something. I had to go back and change the code to fix that and it got a tad out of sync with the video. Sorry for the confusion.