[visionegg] VisionEgg and Python 2.4 - quick and dirty?
- From: Martin Spacek <mspacek@xxxxxxxxxxxxxxx>
- To: visionegg@xxxxxxxxxxxxx
- Date: Sun, 13 Feb 2005 00:45:51 -0800
Hello yet again,
This is long-winded but detailed, apologies:
Unfortunately, it looks like I need to move up to Python 2.4. It
introduces the new 'key' option in sort() (and in the new function
sorted()). This allows you to use the following bit of code to give you
the indices you need to retrieve the elements in a list in sorted order:
########################################################################
# Given a list, find the indices used to get the elements from the list
# in sorted order. Based on a post by Peter Otten on comp.lang.python
# 2004/09/04. This uses the 'key' option to sort and the 'sorted'
# function, both new in Python 2.4. Copied from ASPN.activestate.com,
# this is a recipe submitted by Andrew Dalke on 2004/10/06, Version
# no: 1.1
def sortreport(data):
return sorted(range(len(data)), key = data.__getitem__)
This is exactly what I need to do quick shuffling of lists, while
maintaining knowledge of how to retrieve items in that list in sorted
order. It works well, and it's very fast. The only other obvious way
that I know of is to search through lists using .index(), and on lists
of 10s of thousands, that's proved to be far too slow. The whole point
of all of this is to be able to independently shuffle stimulus
'dimensions' over presentations, so say, if your dimensions were
orientation, temporal, and spatial frequency of a grating, you could
have your orientations and spatial frequencies shuffled independently,
while keeping your spatial frequency dimension in sorted order.
Anyways, I found all the required install packages for Python 2.4:
Numeric, numarray, PIL, PyOpenGL, Pygame. The only thing left is
VisionEgg. Installing from the VisionEgg windows binary for Python 2.3
doesn't work of course. Just copying over the two VisionEgg folders into
the new Python24 directory works, VE runs just fine, except when I want
to run in max priority mode (I'm running Win2K), which depends on
_win32_maxpriority.pyd, a compiled C file. I get a dialog saying that
python23.dll can't be found, and I get the following traceback:
-- snip ---
File "C:\Python24\lib\site-packages\VisionEgg\Core.py", line 352, in
__init__
VisionEgg.PlatformDependent.set_priority() # defaults to max priority
File "C:\Python24\lib\site-packages\VisionEgg\PlatformDependent.py",
line 124, in set_priority
import win32_maxpriority
File "C:\Python24\lib\site-packages\VisionEgg\win32_maxpriority.py",
line 4, in ?
import _win32_maxpriority
ImportError: DLL load failed: The specified module could not be found.
---------
So, I tried checking out VisionEgg with CVS, and then running 'python
setup.py install'. That got as far as:
---------
running build_ext
error: Python was built with version 7.1 of Visual Studio, and
extensions need to be built with the same version of the
compiler, but it isn't installed.
---------
So I set skip_c_compilation = 1 in setup.py. 'python setup.py install'
completed successfully. This time, running VE with max priority = 1 gave
a slightly different traceback:
-- snip --
File "C:\Python24\Lib\site-packages\VisionEgg\PlatformDependent.py",
line 124, in set_priority
import win32_maxpriority
File "C:\Python24\Lib\site-packages\VisionEgg\win32_maxpriority.py",
line 4, in ?
import _win32_maxpriority
ImportError: No module named _win32_maxpriority
---------
because of course that file (_win32_maxpriority.pyd) doesn't exist. Even
when I try copying the old _win32_maxpriority.pyd file in there, I get
the same error.
So now I'm trying to find a copy of Visual Studio 7.1 (that's 2003 in MS
speak) so I can run setup.py with skip_c_compilation = 0.
Here's my question: Is there a quick and easy way to be able to get max
priority for VisionEgg in Python 2.4 in Windows without having to
recompile the _win32_maxpriority.pyd file? Or could someone with a copy
of Vis Studio 7.1 and Python 2.4 compile this file for me? Or is there a
way to do this using MinGW?
P.S. I've noticed that now when I run VE in windowed mode (in Windows
2000, with max priority off of course), the windows pop up at
incrementally distant locations from the top-left corner of the screen,
as normal apps often do in Windows. This is sort of an annoyance as
before they used to stay centered on the screen, which was nice. Note
that currently I'm using:
PyOpenGL-2.0.1.09.py2.4-numpy23.exe and
pygame-1.6.win32-py2.4.exe
so this behaviour might have something to do with changes in one of
those. Just a heads up...
Cheers,
Martin Spacek
PhD student, Swindale lab
Graduate Program in Neuroscience
Dept. of Ophthalmology and Visual Sciences
University of British Columbia, Vancouver, BC, Canada
+1-604-875-4555 ext. 66282
mspacek@xxxxxxxxxxxxxxx | http://swindale.ecc.ubc.ca
======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
- Follow-Ups:
- [visionegg] Re: VisionEgg and Python 2.4 - quick and dirty?
- From: Andrew Straw
- [visionegg] Re: VisionEgg and Python 2.4 - quick and dirty?
- From: Andrew Straw
Other related posts:
- » [visionegg] VisionEgg and Python 2.4 - quick and dirty?
- » [visionegg] Re: VisionEgg and Python 2.4 - quick and dirty?
- » [visionegg] Re: VisionEgg and Python 2.4 - quick and dirty?
- » [visionegg] Re: VisionEgg and Python 2.4 - quick and dirty?
- » [visionegg] Re: VisionEgg and Python 2.4 - quick and dirty?
- » [visionegg] Re: VisionEgg and Python 2.4 - quick and dirty?
- [visionegg] Re: VisionEgg and Python 2.4 - quick and dirty?
- From: Andrew Straw
- [visionegg] Re: VisionEgg and Python 2.4 - quick and dirty?
- From: Andrew Straw