In memory of Ben “bushing” Byer, who passed away on Monday, February 8th, 2016.

Difference between revisions of "WiiPy"

From WiiBrew
Jump to navigation Jump to search
m (Distinguish)
 
(21 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{Infobox homebrewapp
+
{{Distinguish|Wii.py}}
 +
{{Infobox development tools
 
| image      =  
 
| image      =  
 
| title      = WiiPy
 
| title      = WiiPy
 
| desc        = Python on Wii
 
| desc        = Python on Wii
| type        = Scripting Language
+
| type        = ported library
 
| author      = tehpola, comex
 
| author      = tehpola, comex
| download    = [http://serv.qoid.us/wiipy.elf wiipy.elf]<br>[http://www.cs.utexas.edu/~tehpola/PyOGC.cgi PyOGC]
+
| download    = http://code.google.com/p/wiipy/downloads/
 +
| website = http://web.archive.org/web/20090815032812/http://www.cs.utexas.edu/~tehpola/PyOGC.cgi
 
| peripherals = none
 
| peripherals = none
 
}}
 
}}
Line 11: Line 13:
 
Pronounced "weepy".
 
Pronounced "weepy".
  
[http://www.cs.utexas.edu/~tehpola/PyOGC.cgi PyOGC] is an OGC wrapper for Python written in Pyrex (a hybrid Python-C thingy designed for extension developing). The author, tehpola, made a working demo, but the demo itself was made in Pyrex, not real Python. I (comex) hacked Python a little so the interpreter as well would run, and you can run .py files.
+
[http://www.cs.utexas.edu/~tehpola/PyOGC.cgi PyOGC] is a [[Libogc]] wrapper for the scripting Language [http://www.python.org Python] written in Pyrex (a hybrid Python-C language designed for extension development). The author, tehpola, made a working demo, but the demo itself was made in Pyrex, not real Python. I (comex) hacked Python a little so the interpreter as well would run, and you can run .py files.
  
Aside from Python being an awesome language, I think Python on Wii might eventually make it much easier for GUI applications to be developed on the Wii, or really anything
+
Aside from Python being an awesome language, I think Python on Wii might eventually make it much easier for GUI applications to be developed on the Wii, or really anything.  
 
 
Right now, however, it does not have any GUI, and PyOGC itself is incomplete-- this is really just a demo.  The finished version might have have a file selector and maybe a GUI and all that fancy stuff.  However, it does work.  
 
  
 +
Right now, however, it does not have any GUI, and PyOGC itself is incomplete-- this is really just a demo. The finished version might have have a file selector and maybe a GUI and all that fancy stuff.
 
== Usage ==
 
== Usage ==
  
 
To use, download wiipy.elf, run it by the method of your choice, and put a file called "'''run.py'''" on your SD card root containing whatever Python code you want to run.
 
To use, download wiipy.elf, run it by the method of your choice, and put a file called "'''run.py'''" on your SD card root containing whatever Python code you want to run.
  
Besides the modules in PyOGC (the documentation for this is nonexistent, but you can look in the source) you have some basic modules (<tt>math</tt>, <tt>sys</t>), and the standard <tt>open()</tt> function will open files on the SD card. However, notably, <tt>time</tt> is presently not available, nor is <tt>os</tt> and maybe other things.
+
Besides the modules in PyOGC (the documentation for this is nonexistent, but you can look in the source) you have some basic modules (<tt>math</tt>, <tt>sys</tt>), and the standard <tt>open()</tt> function will open files on the SD card. However, notably, <tt>time</tt> is presently not available, nor is <tt>os</tt> and maybe other things.
 +
 
 +
Alpha 2: Network is available, do this:
 +
import net, _socket as socket
 +
net.init()
 +
Then use the socket functions, but there are some bugs:
 +
* socket.accept won't actually tell you the IP address which connected
 +
* You must receive and send data in small chunks. 1024 works, 8192 doesn't (you get a socket error). This is a limitation of the net functions, but future version will deal with this more smartly (chunk data up for you).
  
 +
== Sample ==
 +
Here is a link of a .py port of the original sample file: [http://www.mediafire.com/?t2tdymxd1xi]
 
== Bugs ==
 
== Bugs ==
  
* For some reason, this app seems to fail in weird and wacky ways when launched '''over the network''' from HBC. I've only gotten it to work when launched from the SD card. I haven't tested with any additional loaders or the Twilight Hack. YMMV.
+
* For some reason, this app seems to fail in weird and wacky ways when launched '''over the network''' from HBC. I've only gotten it to work when launched from the SD card. I haven't tested with any additional loaders or the Twilight Hack. YMMV.
 +
 
 +
* If the script crashes, you will not get a delay before an immediate return to the loader. This is because traceback (which would be required to print the stack trace without exiting python) wants to import os for some reason. This is fixable.
  
* If the script crashes, you will not get a delay before an immediate return to the loader.  This is because traceback (which would be required to print the stack trace without exiting python) wants to import os for some reason.  This is fixable.
+
* For some reason importing os results in a "ImportError: Excluded frozen object named errno"
  
 
== Source ==
 
== Source ==
  
The "source" will eventually be a set of directions for how to patch the Python source distribution to build on the Wii, which will be released when this app is improved. Right now, my directions are extremely ugly: for example, they include copying a failed build command, adding the .a files from libogc to the command line, and running that manually.  (Don't ask me why adding the same files in the middle of the command line doesn't work.)
+
comex gave me its patches to PyOGC and python-2.5.2
 
+
I made a google code project, and some simple scripts to somehow automate the build process.  
However, if you really want what I have so far, just ask.
+
http://code.google.com/p/wiipy/source/checkout
 +
--[[User:Tardyp|Tardyp]] 14:47, 2 August 2008 (CEST)

Latest revision as of 19:23, 30 April 2021

WiiPy
General
Author(s)tehpola, comex
TypePorted Libraries
Links
Download
Website

Pronounced "weepy".

PyOGC is a Libogc wrapper for the scripting Language Python written in Pyrex (a hybrid Python-C language designed for extension development). The author, tehpola, made a working demo, but the demo itself was made in Pyrex, not real Python. I (comex) hacked Python a little so the interpreter as well would run, and you can run .py files.

Aside from Python being an awesome language, I think Python on Wii might eventually make it much easier for GUI applications to be developed on the Wii, or really anything.

Right now, however, it does not have any GUI, and PyOGC itself is incomplete-- this is really just a demo. The finished version might have have a file selector and maybe a GUI and all that fancy stuff.

Usage

To use, download wiipy.elf, run it by the method of your choice, and put a file called "run.py" on your SD card root containing whatever Python code you want to run.

Besides the modules in PyOGC (the documentation for this is nonexistent, but you can look in the source) you have some basic modules (math, sys), and the standard open() function will open files on the SD card. However, notably, time is presently not available, nor is os and maybe other things.

Alpha 2: Network is available, do this:

import net, _socket as socket
net.init()

Then use the socket functions, but there are some bugs:

  • socket.accept won't actually tell you the IP address which connected
  • You must receive and send data in small chunks. 1024 works, 8192 doesn't (you get a socket error). This is a limitation of the net functions, but future version will deal with this more smartly (chunk data up for you).

Sample

Here is a link of a .py port of the original sample file: [1]

Bugs

  • For some reason, this app seems to fail in weird and wacky ways when launched over the network from HBC. I've only gotten it to work when launched from the SD card. I haven't tested with any additional loaders or the Twilight Hack. YMMV.
  • If the script crashes, you will not get a delay before an immediate return to the loader. This is because traceback (which would be required to print the stack trace without exiting python) wants to import os for some reason. This is fixable.
  • For some reason importing os results in a "ImportError: Excluded frozen object named errno"

Source

comex gave me its patches to PyOGC and python-2.5.2 I made a google code project, and some simple scripts to somehow automate the build process. http://code.google.com/p/wiipy/source/checkout --Tardyp 14:47, 2 August 2008 (CEST)