1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pyOSCでint64が受け取れなくてはまったメモ

Posted at

状況

UnityOSCからクライアント(pyOSC)にUnixTimeのTickをlong型で送ろうとしたら受け取れなかった

エラーメッセージ

OSCServer: KeyError on request from localhost:49206: 'h'

環境

  • Mac OSX 10.10.5
  • Unity Pro 5.3.2f1
  • UnityOSC v1.2
  • python 2.7
  • pyOSC 0.3.5b5294

原因

pyOSCがint64の受け取りに対応してない

対応

受信メッセージに対するtypeTagの判別はdef decodeOSC(data):内で行っているが
def _readLong(data):の定義はあるのにtypeTagがhの場合に呼ばれてないので
typeTagがhの場合に_readLong()を呼ぶよう修正

具体的には

table = {"i":_readInt, "f":_readFloat, "s":_readString, "b":_readBlob, "d":_readDouble, "t":_readTimeTag}

table = {"i":_readInt, "h":_readLong, "f":_readFloat, "s":_readString, "b":_readBlob, "d":_readDouble, "t":_readTimeTag}

に修正した

その他

  • OSC仕様(和訳)
    これによると64bit整数は認識しなくても良いものみたいなので今回の問題は単純にpyOSCのバグとは言えなそう
  • とりあえずプルリク送った
  • 今回のように時刻を送りたいなら時刻タグ(typetag:t)を使ったほうが正解かも?
  • typeTag:hって何の頭文字?
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?