As explained in my Summer of code 2017: Python post I decided to pick up Python. As explained in that post my son wants to do some game development. with Python you can use Pygame to do game development.
My first attempt to install Pygame didn't end well, the instructions I found were to were to download the pygame wheel file, rename the .whl file to .zip. After that extracting the files into a folder. Then you had to move the header files into the \Python36\include folder. Another thing I had to do was moving the pygame folder and the pygame-1.9.3.dist-info folder into the \Python36\Lib\site-packages folder
After that was done, I got some strange errors, something about init() missing (AttributeError: module 'pygame' has no attribute 'init')
Another option was to use pip
I tried that
C:\Users\dgobo>pip install pygame
Collecting pygame
Downloading pygame-1.9.3-cp36-cp36m-win_amd64.whl (4.2MB)
100% |████████████████████████████████| 4.2MB 234kB/s
Installing collected packages: pygame
Successfully installed pygame-1.9.3
I still had an error after this was done
I noticed that pip installed Pygame into the following folder
\anaconda3\lib\site-packages
Hmmm... what is anaconda and why did pip install Pygame there?
I then navigated to the Python directory, instead of pip install pygame I did python -m pip install pygame
C:\Python36>python -m pip install pygame
Collecting pygame
Using cached pygame-1.9.3-cp36-cp36m-win_amd64.whl
Installing collected packages: pygame
Successfully installed pygame-1.9.3
That did it, after that ran, I had no errors anymore
So all you have to do is..run pip from python, not by itself
Hopefully this will help someone if they run into this issue
Sunday, June 18, 2017
Installing Pygame on windows
Saturday, June 17, 2017
Summer of code 2017: SyntaxError: Missing parentheses in call to 'print'
As explained in my Summer of code 2017: Python post I decided to pick up Python
I looked at some examples and when I tried to run them I was getting an error
It was a pretty simple print statement
print 'Hello world'
Running that produced an error
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> print 'Hello world' SyntaxError: Missing parentheses in call to 'print'
It tuns out, the example I was looking at was for Python 2. In Python 2, print was a distinct statement, in Python 3 print is actually a function call. Function calls require parentheses
If I changed the print statement to the following by adding parentheses.
>>> print ('Hello world') Hello world
Running that worked fine.
Maybe this will help some other poor soul in the future......
Summer of code 2017: Python
I decided to learn/use a language that I don't use for work. I picked Python, I messed around with Python a little 10 years ago or so but decided to give it another shot for 2 reasons.
1) A lot of data scientists are using python in addition to R. Python and R are built into SQL Server 2017, so I might have to support either of these language in the future.
2) My youngest son wants to get into game programming, he will turn 11 next month, he has been messing around with scratch for the past year but wants to do some actual coding this time. I thought Python with pygame would be a good start
So what is the plan?
The idea is to start on Monday June 19th and finish this by August 16, this is 8 weeks, that should be enough to get to a certain skill level
My son has the python book for absolute beginners, he can start on that. Both of us can also watch and download the exercises from Pluralsight
I have already bookmarked the following courses
I installed Visual Studio 2017 yesterday and made sure to add python as part of that install. Here is what it looks like....
I have not used Visual Studio for a long time so I have to also get familiar with this latest version
The idea is also to post several times a week with updates on how it is going, what both my son and myself learned and how it is going in general
Friday, May 26, 2017
Kaizen Day 44, May 25 2017
This post is part of my daily kaizen routine, this is day 44 of that routine
Whenever I plan to go to the city I set my alarm to go off at 4 AM. I will always wake up by myself around 3:57 AM, the alarm will almost never go off while I am still sleeping. Today I woke up at 3:30 AM. I decided to get up...what is the point trying to get another 15 minutes of sleep in
I made myself a cold brew coffee the night before and I drank this between 4 and 4:30 AM
I left the house at 4:30 AM, walked to the train station, this took 40 minutes. I caught the 5:20 train, I read about 30 pages of the book Born to Run by Bruce Springsteen . The train arrived at Newark at 5:55 or so, got on the PATH train and arrived at the World Trade Center station around 6:20
I then walked to the New York Sports Club gym on Broad street and did 30 minutes of cardio which burned a total of 361 calories

For breakfast I had some yogurt and fruit
I had a apple as a snack
For lunch I had a cheese sandwich and a burrito
For dinner we had egg noodles with homemade bolognese sauce, we had sauteed cauliflower on the side
I had a handful of chocolate chips for dessert
Activity for the day
Total steps: 23,628
Total floors: 34
Total distance: 10,9 miles
Whenever I plan to go to the city I set my alarm to go off at 4 AM. I will always wake up by myself around 3:57 AM, the alarm will almost never go off while I am still sleeping. Today I woke up at 3:30 AM. I decided to get up...what is the point trying to get another 15 minutes of sleep in
I made myself a cold brew coffee the night before and I drank this between 4 and 4:30 AM
I left the house at 4:30 AM, walked to the train station, this took 40 minutes. I caught the 5:20 train, I read about 30 pages of the book Born to Run by Bruce Springsteen . The train arrived at Newark at 5:55 or so, got on the PATH train and arrived at the World Trade Center station around 6:20
I then walked to the New York Sports Club gym on Broad street and did 30 minutes of cardio which burned a total of 361 calories
For breakfast I had some yogurt and fruit
I had a apple as a snack
For lunch I had a cheese sandwich and a burrito
For dinner we had egg noodles with homemade bolognese sauce, we had sauteed cauliflower on the side
I had a handful of chocolate chips for dessert
Activity for the day
Total steps: 23,628
Total floors: 34
Total distance: 10,9 miles
Subscribe to:
Comments (Atom)