Cute python: python for PalmOS

Source: Internet
Author: User

Let me introduce it in Pippy good news and bad news jokes. The good news about Pippy is that Python programmers can write and run programs entirely on Palm. Also, it becomes faster, more stable, and easier to use for version 0.7,pippy. The bad news is that, so far, Pippy is still quite "cutting-edge" software, and many of the features programmers want in the development environment are planned in later versions, not yet. However, now that Pippy has provided enough functionality, you can do useful things without too much effort.

Install Pippy

When installing Pippy, first download its executable and/or source files. The source file is the tar package, called pippy-0.7-src.tar.gz, and only the distribution of the executable is called pippy_0_7.zip (or the same file name, but the extension is. tar.gz,. Sit or hqx, depending on the platform). For most users, the distribution of executable files is easiest. First let's take a look at the distribution.

In the Pippy executable file, you will find a relative directory called./pippy_0_7. There are five files in this directory. Read the README-as usual-and then view the LICENSE and NEWS files to understand the desired subject. Locate the PIPPY.PRC and PYLIB.PRC files. These are the files that will be uploaded to the PalmOS device.

How to upload these two files to a handheld device, depending on which desktop operating system is running. Also, any additional applications that have been installed to the PalmOS handheld user will be familiar with the upload process. In Windows and MacOS environments, the "Palm Desktop" and its "Install" buttons are usually used. In Linux or other UNIX-like platforms or OS/2 environments, you might want to use the Pilot-link utility-especially the Pilot-xfer program. This may look like this:

Listing 1. Transfer Pippy and Pythonlib to Palm

$ pilot-xfer /dev/cua1 -i pippy.prc
$ pilot-xfer /dev/cua1 -i pylib.prc

Once the two PRC files are on the PalmOS handheld device, all you need to do is run Pippy (I like to move it to the "Programming" application category, but this is a small convenience).

Compiling Pippy is much more work than downloading executable files. Pippy can be built in two programming environments. One involves installing Prc-tool and Python 1.5.2 on a machine (exactly that version). Installing Prc-tool itself is a complex task that needs to find the library and compiler dependencies and find each of the correct versions. This article does not cover all the details of that type of work.

For Win32 and MacOS environments, compiling Pippy may be easier. First, you need to spend some money to buy CodeWarrior. Second, you need to download and successfully install the free tools Cygwin, PILRC, and Python 1.5.2 (the Python version may also do). Although this method may work less than the Prc-tool method, it is not painless to compile Pippy yourself unless your system happens to meet all the prerequisites.

If you try to build Pippy from your source files, you have the option of compiling them into your own Python extension module and possibly importing them by default. For this article, only assume that you are using the version of the executable file that Pippy distributes. Fortunately, it is fairly easy to run custom code in a precompiled environment since version 0.7.

Using Pippy

Pippy is an interactive environment, similar to the Python interactive shell, but thanks to another PalmOS language/environment called LISPME (see Resources later in this article). So far, Pippy is just this interactive environment, not the way to create stand-alone applications (unless you want to study the source more than I do). But this is enough to make a good start. Let's take a look at what it looks like:

Figure 1. PalmOS handheld device for running Pippy

Using Pippy involves entering Python commands. The figure illustrates this, but you can also create larger constructs, such as function definitions and classes.

One thing to note in an interactive environment is that when you finish writing each statement group, you need to eval it. Unfortunately, this can be confusing because some statements may be ignored in an interactive environment. For example, if you enter the following statement and then press eval, you may almost certainly expect to see print "4":

Figure 2. Pippy sessions with multiple statements at the same time

Listing 2. Pippy sessions with multiple statements at the same time

x = 3
x = 4
print x

Instead, what actually happens is that no value is printed and x is equal to 3. It is hoped that this behavior will be improved in future versions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.