Stackless Python 2.5 for Nintendo DS

2007-01-08 Thread Richard Tew
Hi,

I have updated NDS Python from Python 2.4.3 to Python 2.5 (or rather
the Stackless version of it).

You can read more about it here if it might interest you:
http://www.disinterest.org/NDS/Python25.html

Cheers,
Richard.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is it possible to save a running program and reload next time ?

2006-09-21 Thread Richard Tew
[EMAIL PROTECTED] wrote:
 I have a program which will continue to run for several days. When it is
 running, I can't do anything except waiting because it takes over most
 of the CUP time.

 Is it possible that the program can save all running data to a file when
 I want it to stop, and can reload the data and continue to run from
 where it stops when the computer is free ?

Yes.  Stackless Python can allow you to pickle running code and
to save it to disk and load it and continue running it from where it
left off.  It won't of course work if there is external state because
this will not be there, or necessarily still be relevant when the code
resumes.  So as long as you know the limitations and they suit
your uses, it should be usable for this.

http://www.stackless.com

Here's an example:

import stackless
import cPickle
import time

def f():
n = 0
while True:
n += 1
stackless.schedule()

t = stackless.tasklet(f)()

while True:
# Run the tasklet until it yields or dies.
t.run()
# Yield to the operating system.
try:
time.sleep(0.1)
except KeyboardInterrupt:
if not t.alive:
print Tasklet unexpectedly dead
break

# Serialise the running tasklet.
v = cPickle.dumps(t)
# Kill the old version.
t.kill()

# y / enter = continue
# anything else = exit
# otherwise stalled
s = raw_input(Continue? [y]:).lower()
if s not in (y, ):
break

t = cPickle.loads(v)

Unfortunately KeyboardInterrupt or probably any other
exception as a way of interrupting the running code is
problematic as it will kill the running tasklet if it happens
there instead of during the sleep.

Hope this helps,
Richard.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on Nintendo DS

2006-04-26 Thread Richard Tew
You can find the new port of Python 2.4.3 (Stackless) here:
http://www.disinterest.org/NDS/Python24.html

Even if you do not have a Nintendo DS with the appropriate
homebrewing device to make the rom available to it, you should
still be able to run it within an emulator like Dualis (which is
where the screenshot is taken).

Any comments are welcome :)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on Nintendo DS

2006-04-25 Thread Richard Tew
An update to my Python on Nintendo DS efforts.

Summary:
- Working bug free port of Python for the Nintendo DS.
- Programmers wanted to help write extensions to expose the DS hardware
  to Python.
- Stackless Python supported, but not bug free.

When I last worked on it, it had several remaining bugs including a
broken zipimport, unreliability due to limited stack space and more.

I spent a statutory holiday on it and located and fixed all the bugs,
including the allocation of stack space and the problems with zipimport
(due to a misunderstanding about what seek function API I should
respect).  As it stands now, it seems pretty bug free.

Python itself running on the Nintendo DS with no access to the hardware
features (graphics, microphone, speakers, touchscreen) is not much use.
 As a text-based calculator it serves one purpose I guess. But to
really serve as a useful tool on the DS, it needs to expose these
pieces of hardware.  SDL is one option, as there is a reportedly buggy
port of SDL for the DS, and ideally as PyGame is based on SDL, a port
of that would hopefully be straightforward.

If anyone has an experience writing extension modules in C, and with
programming the DS hardware in C, and wishes to help flesh out some
form of library codebase to make this a useful port of Python, please
let me know! :)

Also, I switched to the Stackless Python code base.   The tasklet
scheduler locks up if invoked, but I haven't had the chance to look
into this yet.  But given that tasklets run and switch in the limited
scenarios I have tried, fixing the scheduler should be a matter of
time.

Richard

-- 
http://mail.python.org/mailman/listinfo/python-list


Stackless Python for 2.4.3

2006-03-30 Thread Richard Tew
Hi,

Stackless Python is now available for the recent release of Python
2.4.3 (final).

You can either obtain the source code from the SVN repository or
download the precompiled windows binaries.

SVN:http://codespeak.net/svn/stackless/Python-2.4.3/dev
Download: http://www.stackless.com/download

If anyone plans to download and compile the source, there are
however some minor things that need to be taken into account which you
may be able to help me with, if you have the time.

 1. I need a generated 'configure' file.  I believe the 'configure.in'
fine should be fine, but if someone could run autoconf and send me
the result so I can check it in, it would be appreciated.

It would be best if anyone planning to do this checked the
Stackless mailing list to see if there was any mention of
someone else already having taken care of it.

 2. Having the Python tests run, and the Stackless unittests run by
various people on different platforms would give a better
indication of the state of the port.

The following instructions are of course Win32 specific, but they
should be translate easily.

a) Retrieve the 2.4.3 source code from SVN at:
   http://codespeak.net/svn/stackless/Python-2.4.3/dev

b) Compile it.

c) Open a console in the 'Stackless\unittests' directory.
   Type '..\..\PCBuild\python.exe run_all.py'.

   The expected result is that one pickling test will fail, this is
   ok and it is the same known bug that we had for 2.4.2, which
   should be easy enough to fix if someone wants to step forward
   and put in the time and effort.

d) Open a console in the top level of the source code.
   Type 'PCBuild\python.exe Lib\test\regrtest.py'

   The expected result is that there will be a lot of skipped
   tests, and possibly some failures depending on your platform.

   I had these fail:
   - test_email
   - test_winsound

   Neither of the errors were necessarily Stackless related, but
   it is possible they are.  But if you see any for your build that
   are unexpected, please mention them.

Thanks,
Richard Tew.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Stackless Python for 2.4.3

2006-03-30 Thread Richard Tew
I would just like to clarify, the windows specific paths do not
imply that Stackless compiles only on Windows, or that the
tests being run on Windows is all I am interested in.

Stackless compiles on a range of non-Windows platforms, including
x86 linux, mac os and others.  And knowing the port works on them
all and is therefore more or less complete except for known issues
is what I am interesting in learning.  Or what has to be fixed.

Thanks,
Richard.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: RPC client class?

2006-03-22 Thread Richard Tew
From Dick Watson:
 We have a legacy device that exposes an RPC server. We have an RPCL
 defininition of its interface. We want to develop an RPC client of this
 interface in Python that will be usable in both Win32 and open systems
 environments.

 I can find some *very* dated references to a demo/rpc.py, but I can't find
 such a file on my Win Python install. There is an rpc.py in idle, but it
 doesn't seem to be a general purpose implementation. (I can find **lots** of
 references to xmlrpc.py, but the server predates all of this neato XML
 stuff. I also found the Stackless rpc.py; it wants to modify base Python.
 I'd rather not diverge from the stock Python.)

The stackless rpc.py is also not an implementation of Sun RPC.  It
just uses Stackless tasklets to enable direct Python function function
calls from server to client and vice versa.  Perhaps it was bad naming
on my part, but I assumed remote procedure calls was a general
technique rather than just a Sun RPC protocol.

Richard.

-- 
http://mail.python.org/mailman/listinfo/python-list


Stackless Python sprint at PyCon 2006

2006-02-17 Thread Richard Tew
There is a Stackless Python sprint planned for PyCon 2006 during the
days of the 27th of February to the 2nd of March (the post-conference
sprint period).

The goal is to update Stackless making it more current and
approachable.  We are planning to port it to the latest version of
Python.  But anyone who has an interest in Stackless is welcome to come
along and help out in any way that appeals to you.

You can read more about the sprint and the talk about how Stackless is
used in the massively multiplayer game EVE Online at PyCon here:
http://www.stackless.com/Members/rmtew/pycon2006

Or browse the following web site to get more information about
Stackless:
http://www.stackless.com/

Richard.

-- 
http://mail.python.org/mailman/listinfo/python-list