Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Wednesday, October 26, 2011

python super()

http://rhettinger.wordpress.com/2011/05/26/super-considered-super/

這裡有介紹python 的super()

裡面講到了__mro__
跟用一個adapter來傳super的args

Tuesday, July 26, 2011

不能執行python script

從同事那拿到一個python script
而發現他跑這個script時都是
$>python test.py

想說 那我在最前面加個 #! /usr/bin/env python
然後$>chmod a+x test.py
所以我只要 $>./test.py就好了

但竟然.......
line 1: #!: command not found

最後用file來看看這個script
$>file test.py
test.py: UTF-8 Unicode (with BOM) Java program text, with CRLF line terminators

最後把內容copy到另一個新的test1.py
test1.py: UTF-8 Unicode (with BOM) Java program text, with CRLF line terminators

就好了........................................................

Wednesday, March 9, 2011

softlink for Android build system

最近試著在mydroid裡 某個folder下用softlink 指到mydroid外的folder
而發現mydroid一直找不到我的這個softlink指的地方
看了看build/底下的code

最後原來是
http://android.git.kernel.org/?p=platform/build.git;a=blob;f=tools/findleaves.py;h=0adf188f9bb5b1e8ced951795cbc8bafdd43cfaf;hb=HEAD#l31

裡的os.walk() default是沒有follow softlink的
http://docs.python.org/library/os.html#os.walk

所以把原本裡的os.walk(rootdir)改成
os.walk(rootdir, TRUE, NONE, TRUE) 就好了