2010年2月12日 星期五
2010年2月4日 星期四
2010年2月3日 星期三
Today I see two python pitfalls
The first one is in the com.lang.python google group article:
http://groups.google.com/group/comp.lang.python/browse_thread/thread/fe6430e7980e2a96?hl=en#
if brief . the python import statement may search module in current path first, and files in the same module has very weak relation such as the followiing example that email.py was used in two place and python finds the wrong one
bash$ touch email.py
bash$ python
...
>>> import smtplib
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.5/smtplib.py", line 46, in
import email.Utils
ImportError: No module named Utils
the second is about generator expression, the variable in the clause is not evaluated or stored immediately and may lead a lot of error. To avoid this, list comprehension or closure are the solutions.
http://yz.mit.edu/wp/2010/01/14/bitten-by-python-scoping/
As I use python much, I always can find something strange as I use it :<
http://groups.google.com/group/comp.lang.python/browse_thread/thread/fe6430e7980e2a96?hl=en#
if brief . the python import statement may search module in current path first, and files in the same module has very weak relation such as the followiing example that email.py was used in two place and python finds the wrong one
bash$ touch email.py
bash$ python
...
>>> import smtplib
Traceback (most recent call last):
File "
File "/usr/lib/python2.5/smtplib.py", line 46, in
import email.Utils
ImportError: No module named Utils
the second is about generator expression, the variable in the clause is not evaluated or stored immediately and may lead a lot of error. To avoid this, list comprehension or closure are the solutions.
http://yz.mit.edu/wp/2010/01/14/bitten-by-python-scoping/
As I use python much, I always can find something strange as I use it :<
2010年2月2日 星期二
Use hdaps in X200S in opensuse11.2
Follow the following links , The idea is clear
http://www.thinkwiki.org/wiki/Tp_smapi#Installation_on_openSUSE
http://forums.opensuse.org/hardware/laptop/417254-tp_smapi-lenovo-thinkpad-t400-t500-w500-step-step.html#post2005932
The main idea is search the build package in opensuse website , just search tp_smapi and hdapsd. with them , we can perform these commands to turn hard disk protection.
modprobe tp_smapi
modprobe hdaps
/etc/init.d/hdaps restart
check by
smartctl -a /dev/sda | grep Load_Cycle
http://www.thinkwiki.org/wiki/Tp_smapi#Installation_on_openSUSE
http://forums.opensuse.org/hardware/laptop/417254-tp_smapi-lenovo-thinkpad-t400-t500-w500-step-step.html#post2005932
The main idea is search the build package in opensuse website , just search tp_smapi and hdapsd. with them , we can perform these commands to turn hard disk protection.
modprobe tp_smapi
modprobe hdaps
/etc/init.d/hdaps restart
check by
smartctl -a /dev/sda | grep Load_Cycle
訂閱:
文章 (Atom)