まず、接続されているUSBシリアルのデバイス名を検索する。
[デバイス名の検索]
Mac
ターミナルというアプリを起動する。
ls /dev/tty.*
と入力してEnterキーを押す。
tty.usbserialXXX、などと表示されたらこれがデバイス名になる。
何も表示されなければ、USBシリアルが認識されていない。ドライバをインストールする。
複数表示される場合は、USBを抜いた状態と挿した状態でのls /dev/tty.*を実行結果を比較して判断する。
Windows
Windowsスタートメニュー - コントロールパネル - デバイスマネージャ、を開く。
ポート(COMとLPT)を展開し、中にあるUSB Serial PortのCOM番号を調べる。
複数ある場合は、USBを抜き差しして判断する。
[送受信待機状態にする]
Mac
ターミナルというアプリを起動する。
screen /dev/tty.XXX
と入力してEnterキーを押す。/dev/tty.XXXはデバイス名の検索で見つけたものを入力する。
何も表示されなければ送受信待機状態になる。
Windows
Tera Termというフリーウェアをインストールする。
Tera Termを起動する。
新しい接続のダイアログで、シリアルを選択し、ポートをデバイスマネージャで見つけたCOMを選ぶ。
OKを押すと送受信待機状態になる。
[信号の送受信]
どちらかの機器で[Aキー]を押すと、もう一方の機器にAと表示される。
12.5.16
Get a list of tracked files of Git by GitPython
The code below is equivalent to git command, "git ls-tree -r master --name-only".
import git
def get_tracked_files(trees):
paths = []
for tree in trees:
for blob in tree.blobs:
paths.append(blob.abspath)
if tree.trees:
paths.extend(get_tracked_files(tree.trees))
return paths
if __name__=='__main__':
repo = git.Repo('.')
tracked_files = get_tracked_files([repo.tree()])
print tracked_files
def get_tracked_files(trees):
paths = []
for tree in trees:
for blob in tree.blobs:
paths.append(blob.abspath)
if tree.trees:
paths.extend(get_tracked_files(tree.trees))
return paths
if __name__=='__main__':
repo = git.Repo('.')
tracked_files = get_tracked_files([repo.tree()])
print tracked_files
登録:
投稿 (Atom)