Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Monday, April 6, 2015

Komodo vs. PyCharm - Teenager Reviews Two Famous Python IDEs

by Kai of Palo Alto High School
As a fifteen-year old novice programmer who codes in Python, I tested two different editors, PyCharm Professional and the new Komodo IDE 9 that was just released.

When I first opened up PyCharm, I felt like it provides the maximum amount of features from the start. Initially, the crowded menu and taskbar were too much of a distraction as I could not figure out what many of the options actually did.  I liked that PyCharm gives me the ability to see the file path of the program I am editing. This is useful when I edit multiple programs at once, as it is easy to quickly distinguish one program from another. 

The other tools worked well and the ability to access old variables when writing new code is nice. My first impression of PyCharm was that it tried to be too versatile and sacrificed usability in the process.
When I opened up Komodo the first thing I noticed was the elegant presentation. The editor relies on alternating color schemes to make text easy to read. The entire window is taken up by the code you are editing. Additionally, the menu consisted of simple icons and pop-up menu’s that made editing and running my program a easy task.

A nice feature is that Komodo lets you know which function you are editing, a feature that would be nice to have in PyCharm. Two arrows at the top of the page allow you to revisit code you were previously editing.

This functionality is extremely helpful for longer pieces of code. Unfortunately, the icon based menu occasionally made it difficult to find what I are looking for. For example, I wanted the command to comment out a section of my code. Usually, it would be housed under the section of the menu called “Edit”. With Komodo there is no such section. Therefore, one either has to reference the “Search” function or have previous knowledge of the command in order to use Komodo effectively. Ultimately, Komodo 9 is a more efficient editor than PyCharm, but is held back by an icon-heavy menu.

Saturday, May 17, 2014

Magic and The 3rd Grade Girl Programmer

Somewhere along our path to adulthood, we stop believing in magic.  What would make us start believing again?

It seems improbable for a 9 year old girl to program.  Yet, I see it.  As she sits in front of a Linux computer slowly typing out code in PyCharm, I think that this tiny 3rd grade girl either represents the future of computer programming or a failed opportunity for everyone.

Adjust the y axis to move the character down the screen with keyboard input, I say.  I do not expect her to succeed.  She does it with the aid of PyCharm's fantastic code completion, happily typing in:



There's a moment of magic.  I imagine every girl in America, daintily typing out our future.  In her face, I see the things that adults would pay a fortune to capture, wonderment, belief, excitement in the aha instant of understanding.  The gears click in her head, she presses the Run button on PyCharm, a Pygame window starts up with a pink girl character in the center of the screen.  Then, the 3rd grade girl coder presses the down arrow key on her Logitech keyboard.  And, the girl on the screen moves down.

  First Hacker in History
She talks about Barbie, My Little Pony, Hello Kitty, and Ada Lovelace, creator of the world's first computer algorithm.  She knows about Ada Lovelace's work on the Babbage Analytical Engine, because girls talk in 3rd grade, letting the boys know that the world's first computer programmer was female.  I hope that their girl power feeling of superiority continues on through high school.



I let her know about the Top Secret Rosies documentary of the heroic women programmers during WW II.  She wasn't surprised.


Leading ENIAC hackers mid to late 1940s

Grace Hopper in 1952 with a UNIVAC 1


More links to great female programmers.

Thursday, May 15, 2014

Windows 8.1 and Pygame Subset for Android (pgs4a)

I recently got asked a question about Windows installation on the PyChildren forum.

Here's the question:

When I touch the icon, the screen turns black, and then it goes back to my apps page in my phone. I then run the logcat to find the problem, but all it gives me is this:


V/python ( 676): Extracting private assets.
I/python ( 676): extracting private.mp3 to /data/data/com.bennybear.fungame/files
The user was not using an mp3 sound file.  When the person extracted the Windows compressed package for pgs4a, the file got added into a sub-directory of the build.    Since I was helping my son to install pgs4a on his Windows 8.1 computer, I was able to replicate the problem.   I think that the process of unzipping or extracting the pgs4a file partially failed.  When I compared the pgs4a files on two different Windows 8.1 computers, I noticed they were different.

I then went to the pgs4a site and downloaded a tar.bz2 archive.  I used tar jxvf on cygwin to extract the files.

A working directory is shown below.




Note that inside of the pgs4a-0.9.6 directory, there is not another sub-directory called pgs4a-0.9.6.  In the failed builds, I noticed that there was a temporary pgs4a-0.9.6 file created in the same directory and all the files from that directory were not properly copied into the main directory.

Once I had the files properly extracted, I noticed that the python android.py installsdk script was giving me error messages.  The script was failing to install android-api-15 and android-api-8.  I used the android.bat program in the android-sdk\tools directory to update the android SDK APIs.  

If you get an error message indicating that ant cannot find the build.xml file, this usually indicates that you don't have the proper Google APIs installed from the Android SDK (not the pgs4a android.py installsdk script).  In almost all cases, I've had to install the Google APIs with the android sdk.  On windows, the android sdk manager is called android.bat

There is another pgs4a tool called android.py.  These tools are completely unrelated.

Once I had those installed, the build went fine.  In order to connect the Windows 8.1 laptop to my son's Motorola Moto G Android phone, I had to go to the Motorola site and install the driver.  With driver from Motorola, adb was able to detect the phone and install went smoothly.

I also installed it on my Samsung Galaxy phone from his Windows 8.1 laptop.


This seems like a pain in the rear, but I encourage you to keep going.  Pygame is fun because it makes it easy to bring the creative ideas from your brain into reality very quickly.   By putting these ideas, your works of art, on a phone, you can show your friends and help them to understand a bit more about how you think as a person.

My long term goal for my children is for technology to serve as a tool for creative expression, not a barrier.  It should be fun and frivolous.  Games are great learning tools.  The work and lessons here should not be viewed through the lens of making money or job-training.  These experiments with children are about developing creative thinking and techniques to express ideas.  Sure, it's a pain to get pgs4a to install sometimes.  I agree.  But, I still think it's the best way to get kids and adults up to speed to be able to take their ideas and prototype them on a mobile phone.  

Have fun!

If you have questions or would like to join the discussion, go to the PyChildren Forum.



Monday, March 17, 2014

Python Android App Debugging Tip: adb and python print statements

With the phone connected to the USB cable and in debug mode, open a new terminal window and type:

  $ adb logcat |grep python

Update 10/11/2014. Windows users, see below. An alternative to using grep:

$ adb  logcat python *:s


You can now view standard python output from applications running on your android phone with python print statements. Output of logcat
I/python  ( 2392): play sounds
I/python  ( 2392): play sounds
I/python  ( 2392): play sounds



The most common problems with Python Subset for Android Apps dying on the Android phone at startup:
  1. you didn't import the sound mixer module properly
  2. your fonts are not in the main program directory
  3. your sound files are not in the main program directory
  4. your graphic files or map files are not in the main program directory
  5. you are using a python module that is not in your main program directory
Note that there's a common theme here of a desktop program working because the assets exist somewhere on your desktop machine, but those assets don't get transferred to your phone.  Look at your sound, graphic, and font files to make sure they are in your main directory.

In the problems above, the adb logcat command will usually show you what asset the program fails to load.

You'll save time in the debugging process if you open up two terminals at once.  In one terminal, run the adb output.  In the other terminal, build and install your program onto your phone.  With the USB cable connected, run your application on your phone.

Check to make sure you are initializing the android library.


Make sure you are importing the mixer module as shown below. In previous versions of pgs4a, I had problems with audio files that weren't in *.wav format. I only use wav files now.

Another common problem is that your application is not named main.py.

Make sure you have called the application main.py and that you are building the application with the name of the directory that contains your application.

if you are using the sgc gui toolkit with android, you need to make sure that the fonts are loaded prior to setting up the sgc screen. I've had several occasions when I got the order wrong the my application worked on the desktop and crashed on the phone. This code below is only relevant if you use sgc, which is definitely not needed to make games on android. However, if you do use sgc to make your buttons and sliders, it can be a bit tricky to use on android.




Update: 10/11/2014 As my son is starting to do some development on Windows 8.1, I realized that he didn't have grep installed and didn't really need to go through the hassle of installing grep with cygwin. I looked at the filter options for adb logcat. The key is to set everything to silent except for strings containing python. Here's some docs built into adb that are somewhat difficult to understand. The only one that you need to use is the -s or *:s
Usage: logcat [options] [filterspecs]
options include:
  -s              Set default filter to silent.
                  Like specifying filterspec '*:s'
  -f    Log to file. Default to stdout
  -r []   Rotate log every kbytes. (16 if unspecified). Requires -f
  -n       Sets max number of rotated logs to , default 4
  -v      Sets the log print format, where  is one of:

                  brief process tag thread raw time threadtime long

  -c              clear (flush) the entire log and exit
  -d              dump the log and then exit (don't block)
  -t       print only the most recent  lines (implies -d)
  -g              get the size of the log's ring buffer and exit
  -b      Request alternate ring buffer, 'main', 'system', 'radio'
                  or 'events'. Multiple -b parameters are allowed and the
                  results are interleaved. The default is -b main -b system.
  -B              output the log in binary
filterspecs are a series of
  [:priority]

where  is a log component tag (or * for all) and priority is:
  V    Verbose
  D    Debug
  I    Info
  W    Warn
  E    Error
  F    Fatal
  S    Silent (supress all output)

'*' means '*:d' and  by itself means :v

If not specified on the commandline, filterspec is set from ANDROID_LOG_TAGS.
If no filterspec is found, filter defaults to '*:I'

If not specified with -v, format is set from ANDROID_PRINTF_LOG
or defaults to "brief"

Sunday, March 9, 2014

Update on 9 Year Old Girl Learning Python

March 5th and 6th, 2014

Lessons focused on using blit to get a graphic of a girl onto the screen instead of a rectangle.  The lessons went smoothly.  I was surprised that she wasn't as excited about the graphic as I had thought she was going to be.  The standard rectangle may be sufficient to keep her attention.

She's still having challenges with manipulating the mouse for copy and paste techniques.  Her use of the keyboard is improving.

I realized that the use of pos = pygame.mouse.get_pos() to control onscreen graphics is easier than using the keyboard and then manipulating  x +=1 , y +=1 to move the rectangle around the screen.

Other tasks she accomplished:

  • created map background with Tiled map editor.  Began to learn about game tiles.  The map background does not have collision detection.  It is just one image that is blitted to the screen.
  • basics of map layers and graphic layers


March 9, 2014

I'm starting to learn more about her personality based on what graphics and sounds she chooses.  A big part of the lessons is the experience of a father/daughter bonding activity.  In a way, it doesn't matter if she learns programming or not.  Though, it is gratifying that she is interested in the activity and seems to have a knack for it.

Mouse manipulation and typing ability are vastly improved.  I'm shocked at how fast she's learning things, including the physical skill of typing.  If I didn't actually see a kid this age use PyCharm, I wouldn't believe that it was possible.  As I don't have another 9 year old kid to experiment with, I am assuming that she is typical and am using her as the baseline with only one data point.

Topics covered:
  • Use of gimp to edit graphic files.  
    • Add alpha transparency layer to graphics by using magic select and deleting the background.  
    • Scale image to fit on screen.  Learn more about pixel size for both image and screen.
  • Use of audacity to record and edit sound files
  • Load sound files with mixer.Sound()
  • Play sound files with name.play()
  • Collision detection with rect.collidepoint(pos)
  • I loaded the game on an Android phone for her so that she can see how easy it is to create these game on a mobile device.  She seemed to favor the desktop.  She's too young to use a mobile phone and doesn't have too much experience using them.
Video with sounds.



Game running on Android phone.





The code that the 9 year old girl wrote in PyCharm is shown below. Note that she starts with a completely blank editor screen at the start of each lesson. This means that she's repeated typing in the exact same base code from lesson 2 five times so far and has typed in the base code from lesson 1 an additional five times. I've started to modify the lesson so that she can extend the base code of lesson 2 to do what she wants.  It is important to note that up to this point, she has not used any math.  There are no addition or subtraction formulas.

The primary mathematical concept so far is for her to understand which of two numbers are greater than the other.  I am purposely using a screen that is 480 x 320 so that she can deal with manageable numbers, keeping integers under 1,000.

In the example below, she just needs to understand the following:

  • screen is 320 pixels high and 480 pixels wide
  • the middle point of the height is 160 pixels
  • the middle point of the width is 240
  • if the she wants the heart, zebra, and chipmunk to be at the same height, the center y coordinates need to all be 160 pixels down from the top of the screen
  • making the x axis smaller moves things to the left (note that be aware that the child may not know left and right.  Take this into account in your teaching.  Point to the appropriate direction if needed).
  • making the x axis larger moves things to the right (IMO, still too early for addition at this lesson.  Just use a single point.  In this case, heart, zebra, chipmunk)
  • similar concept to for the y axis
  • variable is used to hold the image after loading (handle)
  • variable is used to hold the sound after loading (handle)
  • once the image and sound are loaded, she can use the asset handle to make it do things like display to the screen or play the sound
  • collision detection is used to trigger an action.
There's quite a bit of concepts here.  I suggest repeating these concepts multiple times before extending it to addition and subtraction.


Monday, March 3, 2014

Day 8 Girl Learning Python at Age 9

I’m surprised that I’ve needed to increase the difficulty of the lessons for my daughter. Her typing is getting better. The code completion of PyCharm is awesome.
I’ve developed five drills based on this experience.

Drill 2.5

import pygame,sys  import random    pygame.init()  clock = pygame.time.Clock()    size = (480,320)  screen = pygame.display.set_mode(size)    while True:      for event in pygame.event.get():          if event.type == pygame.QUIT:              pygame.quit()              sys.exit()      p = pygame.mouse.get_pos()      c1 = random.randrange(20, 255)      c2 = random.randrange(20, 255)      c3 = random.randrange(20, 255)      color = (c1, c2, c3)      pygame.draw.circle(screen, color, p,10)      clock.tick(30)      pygame.display.update()  

Drill 2.4

import pygame,sysimport random    pygame.init()  clock = pygame.time.Clock()    size = (480,320)  screen = pygame.display.set_mode(size)    while True:      for event in pygame.event.get():          if event.type == pygame.QUIT:              pygame.quit()              sys.exit()      c1 = random.randrange(20, 255)      c2 = random.randrange(20, 255)      c3 = random.randrange(20, 255)      color = (c1, c2, c3)      x = random.randrange(0, 480)      y = random.randrange(0, 320)      pygame.draw.circle(screen, color, (x,y),20)      clock.tick(3)      pygame.display.update()  

Sunday, March 2, 2014

First Week of Python for 9 Year Old Girl

My 9 year old daughter is on day 7 of her Python learning experiment. The classes are going extremely well. Her typing is still the biggest obstacle, especially when she tries to hit ( ) with the correct fingers. The = sign is also a bit of an issue.
I reviewed lesson 2, drill 1 with her tonight. She’s completed 5 drills from lesson 1, which means that I had her start from a blank screen five times and type the same code in. It’s been smooth. I’m surprised.
Since lesson 2 is almost the same as lesson 1, she’s typed basically the same code in six times. I keep waiting for her to get bored. It hasn’t happened yet. She seems strangely interested in the IDE, mouse and keyboard.
She wanted to extend lesson 2 with different colored rectangles. In order to generate the colors, she used an online color generator. I’ve since installed both Gpick and Gcolor2 to allow her to pick the colors from the desktop.
import pygame,sys

pygame.init()

size = (480, 320)
screen = pygame.display.set_mode(size)

RED = (255,0, 0)
GREEN = (0, 200, 0)
PURPLE = (157, 0, 254)
player_rect = pygame.Rect(150, 160, 80, 80)
r = pygame.Rect(10, 160, 80, 80)
r2 = pygame.Rect(300, 160, 80, 80)


while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()

    pygame.draw.rect(screen, GREEN, player_rect)
    pygame.draw.rect(screen, RED, r)
    pygame.draw.rect(screen, PURPLE,r2)
    pygame.display.update()

Sunday, February 23, 2014

9 Year Old Girl's First Exposure to Python


I started my 9 year old daughter with my revised Python curriculum today.  The results were very good.  She was able to accomplish these tasks:

  • Create a graphic screen on Linux with usable exit, minimize and maximize window functions;
  • Use the PyCharm IDE with code completion;
  • Run the program and understand terminal output.
The basic concepts she's dealing with:
  • import python modules;
  • while loop;
  • for loop running through an event queue;
  • graphic surface creation;
  • graphic screen update.
The primary challenge right now is the physical skill of typing.  She's learning to type with a typing game program in parallel with learning the Python curriculum.  Children are different than adults and that their ability to manipulate a mouse and keyboard needs to be taken into account.  It's a big factor in their learning speed.  I think that teaching them piano may help with typing since they'll get used to using their fingers to hit keys in rapid succession using complex patterns.    

So far, it seems like a modern IDE like PyCharm or Komodo makes programming a lot easier for children.  Although I did teach her to use Scratch, I feel that I should have gone directly into Python with PyCharm or Komodo from age 8.  Scratch also has some challenges with using the mouse to manipulate the blocks.  The challenges of learning this physical skill are similar to using the keyboard to type letters into PyCharm.  


Surprisingly, her interest level is about the same with Python as it is with Scratch.  

I am also supportive of Scratch and Alice or Blockly.  With the rather weak state of programming teaching curriculums in primary and middle school in the US, I am supportive of any effort to teach kids to program.  These tools seem to work for many children.  I applaud them.  

My teaching experiments focus on Python with an IDE for children.  My concern with Scratch, Blockly and Alice is that kids need to make the jump from a graphical IDE to a text IDE at some point.  There's a range of problems that come up when they have to use a text IDE, the main challenge is frustration when they encounter a syntax or logic error.    I'm trying to see how far young children can get by going straight to Python and then bridging to other languages like JavaScript, HTML, Ruby, and Java.  

My theory is that the main thing that children need to learn is not actually about programming constructs such as loops or data structures.  My theory is that the main thing the child needs to learn is how to deal with frustration and ways to get beyond the frustration of errors.  In my opinion, the graphical approaches reduce the frustration too much.

My curriculum is designed only for two kids, my own children.  Other parents can use the curriculum if there's commitment to spend time with your child.   It's designed so that the parent is sitting right next to the child during the whole lesson.  For a 9 year old girl, this is about 30 minutes per class with one class every week, possibly less. 

I love to hear about other experiments to teach children to program.  

Wednesday, February 19, 2014

Collision Detection and Zombie Chase - Lesson 7 in the Beginner Series


New video in the seven lesson beginner series focuses on a way to get a monster to chase the girl.  An important point here is the use of colliderect to detect when two rectangles hit each other.  Collision detection of two or more rectangles is the fundamental of shooter games.

In this example, I use two graphics for the Zombie to allow him to run left and right when he's facing the appropriate direction.  Since I'm using the same rectangle for both graphics, I just have one colliderect check.

 

    if player_rect.colliderect(zombie_rect):
        screen.fill(RED)

player_rect is the girl's rectangle.


The algorithm to chase the girl is shown below:
    # chase the girl
    if player_rect.centerx < zombie_rect.centerx:
        zombie_rect.centerx -= 1
        zombie_horiz = "left"
    elif player_rect.centerx > zombie_rect.centerx:
        zombie_rect.centerx += 1
        zombie_horiz = "right"
    if player_rect.centery < zombie_rect.centery:
        zombie_rect.centery -= 1
    elif player_rect.centery > zombie_rect.centery:
        zombie_rect.centery += 1

New to PyChildren, the drill-based Python learning curriculum for teenagers?  Check out the link below to get started learning Python from zero.

An eleven lesson video set is available.

Code repository on GitHub.

Download entire code repository as a Zipped file.




Thursday, December 5, 2013

kivy - alternative to Pygame

 

I looked at pyglet two years ago in October of 2011.    Since that time, I haven't gone back to it.  I've been focused on Pygame Subset for Android.  As far as I know, Pyglet doesn't work on Android phones.  I also like the Pygame documentation more than the Pyglet documentation.

Another library, kivy, does work on Android.  It should also work on iOS.  I haven't tried it myself on either Android or iOS.  My son and I have used it on Linux and it does work great on Linux.

My son was able to build a pong game from the tutorial in one session.  Kivy has a lot of potential and I want to go back to it.

The reason I'm still using Pygame for my lessons is that my son is still getting used to object oriented programming.  With Pygame, the program is can be made more easily with one long block of code.  He can then go back to change the program components into functions or classes.

With kivy, he has to immediately start using classes.

Here's the basic "Hello, World" in Kivy.




While this is actually shorter than a Hello World program in pygame, it does require class instantiation, which is a bit difficult to understand for a young teenager.

The kivy documentation is also considerably weaker than the pygame documentation.  Since kivy is a younger project, I've also experienced more problems with getting the libraries to work all the time on my Linux system.  For example, when I updated Ubuntu 12.04 to the beta NVIDIA Driver, 325, kivy stopped working.  However, pygame was still working.  This may be due to an error with the NVIDIA driver GL implementation and have nothing to do with Kivy.  However, it does show that with less people using Kivy, more things can go wrong.

The advantages I can see for kivy are:

  • multi-touch support.  This is huge.  Pygame only supports a single point.  Although there are some hacks to use the joystick module to detect multiple inputs, it's not that clean a solution.  Getting multi-touch support is a major draw.
  • iPhone, iPad support.  It doesn't look easy to do and I've never done it.  There are some apps on the Apple Store.  So, it's possible to get it to work.  I'm sure it will get easier as the platform matures.
  • GPU acceleration.  The fancy OpenGL ES 2 support makes it easier to do cool 3D effects
  • Android and iPhone support is provided by the core maintainers.  For Pygame, we need to rely on the separate pygame subset for android project (which probably won't support multi-touch since the key developer wants to keep the feature set similar to what is on the base pygame library.)
  • The development community around adding features to the platform seems to be more active than the pygame development community.
The downsides for the purpose of teaching:
  • Pygame documentation is better
  • More people use Pygame and there are more examples of Pygame code
  • The larger pygame community means that most problems have already been solved by other people.  Much more answers on stackoverflow
  • Kivy uses the KV Design language in a separate file.  It gets a bit like JavaScript where you have multiple languages for one application.  There's upsides and downsides to this approach.  The main downside is that there's a slightly steeper learning curve for the kids.
Despite the shortcomings, I'm most likely going to revisit kivy in my curriculum after my son gets through his 2D Maze games.    This assumes that I don't start on django.



Tuesday, November 26, 2013

2D Tiles Games - More Algorithms to Slice Tilesets


Prior to heading out to go fishing, I came across this nice post on slicing a tileset into rows and columns.  The example uses Surface.subsurface, which I haven't been using effectively.





The author wrote a more elaborate tutorial here.

The author of bitcraft-PyTMX used the code below to handle tilesets.




I plan to review the code snippets above in more detail after the fishing trip.

Sunday, November 24, 2013

Pygame on Android App Crashes on Start: FIXED

A good tileset in the wrong place at the wrong time
After catching Jack smelt in Capitola and seeing an amazing display of seals, dolphins, and school of tens of thousands of fish, my son worked on his 2D tile map game, Maze.  The Android app consistently crashed on start.  It would display the initial splash screen and then die, leaving no error message.

This has happened in the past with other games.  We usually solve the problem with adb, the Android debugger.  Today, the fix was easy.  However, since I know that it can be daunting to wade through the adb logcat, I'll provide a few tips specific to Python / Pygame Subset for Android debugging.

My son's game uses Python and pgs4a.  He also uses Tiled to export JSON map files. 

First, find adb on your system.  It's not something that python developers normally use from the command line.  adb is in the platform-tools sub-directory of the android-sdk main SDK directory.

 
 From the Linux command line, you can either just run adb logcat or you can run it through grep and look for references to python.

 

 A larger snippet of the log file is shown below.


 In this case, the error was an incorrect reference to the tileset graphic.
  

The error is caused by a relative reference to a non-existent file.  Although the program works on the desktop, it doesn't work on the phone.  The fix is to place the tileset files in the same directory or sub-directory of your main.py program and create a new map and tileset with tiled.  If you've already created an extensive map, you can also edit the json file with a text editor to have it reference the correct location.

In this example, the file is called grass_water_terrain.png.

In a previous game, my son had a similar problem with the app crashing when it tried to load a font file that was in the wrong location.  Fonts and graphics are the two most common problems.  If you have all your fonts and graphic files in the same directory and your program still doesn't work on Android, but works on your desktop, you may be trying to import a library another directory.  Everything needs to be in the directory where main.py is or in a sub-directory.

If the application works on your desktop and it builds and then loads onto your phone fine, but crashes on start, think through what files the application is trying to load on the Android phone.  Then, work backwards and think through the differences between the phone directory structure and your desktop.  Also, think about the obvious things.  Check that you imported the android library and you've initialized it android.init().

If the problem is not immediately obvious, fire up adb and look for references to python.

Checklist:

  • import android library
  • initialize android library
  • main game file is called, main.py
  • graphic files are in the main or sub-directory
  • font files are in the main or sub-directory
  • custom libraries that you wrote are in the main or sub-directory

Update: March 3, 2014
One of the viewers of my pychildren YouTube channel had a problem with sound.  The important section is to map pygame.mixer and android.mixer to mixer.


try:    import pygame.mixer as mixer except ImportError:    import android.mixer as mixer

The other problem with sound is that there may be problems with different types of sound formats.  I suggest you use .wav files.  Since sound is handled differently on Android and the desktop, a few problems occur.