Actions

Difference between revisions of "Programming"

From ACL@NCU

Line 1: Line 1:
==Python==
==Python==
*[http://openpyxl.readthedocs.org/en/latest/ excel xlsx file read/write]
----
*PsychoPy
*PsychoPy
** [https://groups.google.com/forum/?fromgroups#!searchin/psychopy-users/avbin.dll$20fail$20to$20load/psychopy-users/Hk5nlVAOqYE/_1zLkcU-ZCMJ More issue with pyglet/avbin]
** [https://groups.google.com/forum/?fromgroups#!searchin/psychopy-users/avbin.dll$20fail$20to$20load/psychopy-users/Hk5nlVAOqYE/_1zLkcU-ZCMJ More issue with pyglet/avbin]

Revision as of 13:30, 5 October 2013

Python


Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\UserHomes\PsychoPy2\lib\
site-packages\psychopy-1.74.01-py2.6.egg\psychopy\sound.py", line 48, in <module>
    import pyglet
  File "C:\UserHomes\PsychoPy2\lib\site-packages\pyglet\__init__.py", line 70, in <module>
    lib = ctypes.cdll.LoadLibrary('avbin')
  File "C:\UserHomes\PsychoPy2\lib\ctypes\__init__.py", line 431, in LoadLibrary
    return self._dlltype(name)
  File "C:\UserHomes\PsychoPy2\lib\ctypes\__init__.py", line 353, in __init__
    self._handle = _dlopen(self._name, mode)
WindowsError: [Error 998] Invalid access to memory location
  • Using Chinese Fonts

The Chinese font name (e.g., 標楷體) is not easily used by python scripts. However, with softwares such as Microsoft font editor, one can find the "Unique name" of the font files in %windowspath%\Fonts\. For example, "標楷體" has an unique name "DFKai-SB", which is just like "Arial" that can be used in the script.

welcome[0] = psychopy.visual.TextStim(winobj, 
	text='歡迎您來玩「尋找大方向」遊戲!'.decode(syscode),  
	pos=[0.0, 0.15], color=(1.0, 1.0, 0.0), rgb=None,
	colorSpace='rgb', opacity=1.0,height=0.20, font='DFKai-SB', 
	alignHoriz='center', bold=True, wrapWidth=0.3)
  • Problem in installing packages
    • "error: Unable to find vcvarsall.bat"[1] when running
pip install cffi

But vcvarsall.bat exists on the system. This is because python 2.7 does not support MS Visual Studio ver > 8.0. To fix it: modifing the Lib\distutils\msvc9compiler.py can make it support vs 10.0 change 304 line

VERSION = get_build_version()

to

VERSION = 10.0

and add,

ld_args.append('/MANIFESTFILE:' + temp_manifest) #line 684
ld_args.append('/manifest')

Matlab

Version Control