Python 101 – Day 1

I’m working on a bit of a pet project this week and without going into an explanation of what I’m working on (mainly because I’m kind of figuring it out as I go :)), I’m going through some training to formally learn Python. I’ve dabbled with it before but I wanted to do something a bit more structured to cover all the bases so I’m taking some Pluralsight courses. I thought it would be good to post up a few notes each day with items worth sharing and/or saving for later when I forget. Like tomorrow. So day 1…

Beyond basic helloworld, data types, loops, string manipulation, and other basic programming tasks, day 1 had some development environment learnings I wanted to note. While the course I’m taking is mainly using PyCharm, I wanted to use VS Code. There’s a Python extension for Code so all is good there. I also prefer to use WSL, which added some wrinkles.

WSL is currently running Ubuntu 16.04, which means to get Python 3.6 installed you either need to build it locally or pull it down from a PPA. Using a promising post I found, I first tried to build locally and then quickly “reminded” myself that I don’t have a c compiler installed. So I punted and went the PPA route. Now my WSL environment has Python 2 (2.7.12) and 3 (3.5.2 and 3.6.3) installed. Golden.

Keep in mind I didn’t install Python in Windows, just WSL. This means (as I found out) a few things won’t work as desired:

  • Intellisense in Code doesn’t work as I think it picks up hints from the Windows Python installation
  • Debugging in Code doesn’t work
  • “Run Python file in terminal” functionality in Code doesn’t work (tries running Windows python)

That last one is exacerbated a bit due to me running WSL as my terminal in Code. So I can manually execute python3 and run my code in the IDE, but none of the built in tooling works to make it seemless. I tried to figure out if I could trick Code into using my WSL version of python through some settings, but that didn’t help. Below is as close as I got, but it’s still using a Windows path instead of Linux path format.

So until we can run VS Code directly within a WSL environment, I think my ideal dev environment isn’t possible. Bummer, but I’ve been meaning to spend more time on my Fedora machine anyway, so looks like the rest of this week will be on that OS.

Day 2
Day 3
Day 4

Leave a Reply

Your email address will not be published.