Difference between revisions of "Programming"
From ACL@NCU
(→Python) |
|||
Line 20: | Line 20: | ||
*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] | ||
[Pyglet_avbin_problem] | |||
*Using Chinese Fonts | *Using Chinese Fonts |
Revision as of 10:37, 6 November 2013
Python
- excel xlsx file read/write
- PyInstaller Manual
- Issues in using PyInstaller with Tkinter
TKinter is used in easygui for creating GUIs. Somehow when installing PyInstaller, the system will use the python in Panda package if it is installed on the system, which may not have all the required modules. Therefore, a quick solution is to first remove all Panda installations on the system, and then install the PyInstaller package again. There is sometimes also a warning saying that:
WARNING: file already exists but should not: C:\Users\username\AppData\Local\Temp\_MEI86402\Include\pyconfig.h
This is caused by repetitive importing of the pyconfig.h in the current release of PyInstaller. To fix it, one can manually "patch" the problem by adding the following lines into the *.spec file (generated after using python makespec.py <yourfile.py>):
for d in a.datas: if 'pyconfig' in d[0]: a.datas.remove(d) break
Not as convenient as one would hope, but it works (see similar issue here).
- PsychoPy
[Pyglet_avbin_problem]
- 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')