{"action":"created","issue":{"url":"https://api.github.com/repos/vysheng/tg/issues/587","labels_url":"https://api.github.com/repos/vysheng/tg/issues/587/labels{/name}","comments_url":"https://api.github.com/repos/vysheng/tg/issues/587/comments","events_url":"https://api.github.com/repos/vysheng/tg/issues/587/events","html_url":"https://github.com/vysheng/tg/issues/587","id":83680479,"number":587,"title":"[Python] crash when ```on_msg_receive```","user":{"login":"luckydonald","id":2737108,"avatar_url":"https://avatars.githubusercontent.com/u/2737108?v=3","gravatar_id":"","url":"https://api.github.com/users/luckydonald","html_url":"https://github.com/luckydonald","followers_url":"https://api.github.com/users/luckydonald/followers","following_url":"https://api.github.com/users/luckydonald/following{/other_user}","gists_url":"https://api.github.com/users/luckydonald/gists{/gist_id}","starred_url":"https://api.github.com/users/luckydonald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luckydonald/subscriptions","organizations_url":"https://api.github.com/users/luckydonald/orgs","repos_url":"https://api.github.com/users/luckydonald/repos","events_url":"https://api.github.com/users/luckydonald/events{/privacy}","received_events_url":"https://api.github.com/users/luckydonald/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":23,"created_at":"2015-06-01T20:33:23Z","updated_at":"2015-06-04T06:21:50Z","closed_at":null,"body":"My simple python script crashes when receiving new message,\r\nmore specific, when trying to access the content of the ```msg``` variable.\r\n(print, debugger, etc).\r\n###### python.py\r\n```python\r\nimport tgl\r\n\r\ndef on_msg_receive(msg):\r\n\tprint(msg)\r\n\r\ntgl.set_on_msg_receive(on_msg_receive)\r\n```\r\n**Edit**: Surprisingly ```print(msg.id)``` works.\r\n    \r\n###### CLI\r\n```shell\r\nmac:tg luckydonald$ bin/telegram-cli -Z python.py\r\nTelegram-cli version 1.3.1, Copyright (C) 2013-2015 Vitaly Valtman\r\nTelegram-cli comes with ABSOLUTELY NO WARRANTY; for details type `show_license'.\r\nThis is free software, and you are welcome to redistribute it\r\nunder certain conditions; type `show_license' for details.\r\nTelegram-cli uses libtgl version 2.0.2\r\nTelegram-cli uses libpython version 2.7.5\r\nI: config dir=[/Users/luckydonald/.telegram-cli]\r\n *** Python Initialized\r\n *** Callback not set for on_our_id *** Callback not set for on_secret_chat_update *** Callback not set for on_secret_chat_update *** Callback not set for on_secret_chat_up *** Callback not set for on_user_update> SIGNAL received\r\nS0   telegram-cli                        0x0000000100e2dcc4 termination_signal_handler + 132\r\n1   libsystem_platform.dylib            0x00007fff8bd8c5aa _sigtramp + 26\r\n2   ???                                 0x0000000000000001 0x0 + 1\r\n3   Python                              0x000000010e3a477c PyUnicodeUCS2_FromFormat + 148\r\n4   telegram-cli                        0x0000000100e4af1a tgl_Peer_repr + 266\r\n5   Python                              0x000000010e384bde PyObject_Repr + 49\r\n6   Python                              0x000000010e3a3bbd PyUnicodeUCS2_FromFormatV + 791\r\n7   Python                              0x000000010e3a477c PyUnicodeUCS2_FromFormat + 148\r\n8   telegram-cli                        0x0000000100e4b1db tgl_Msg_repr + 379\r\n9   Python                              0x000000010e384d34 _PyObject_Str + 127\r\n10  Python                              0x000000010e384dca PyObject_Str + 15\r\n11  Python                              0x000000010e384a8c PyObject_Print + 242\r\n12  Python                              0x000000010e36c63f PyFile_WriteObject + 137\r\n13  Python                              0x000000010e3cec07 PyEval_EvalFrameEx + 10826\r\n14  Python                              0x000000010e3cc093 PyEval_EvalCodeEx + 1641\r\n15  Python                              0x000000010e373796 PyFunction_SetClosure + 809\r\n16  Python                              0x000000010e355f72 PyObject_Call + 101\r\n17  Python                              0x000000010e3d201f PyEval_CallObjectWithKeywords + 93\r\n18  telegram-cli                        0x0000000100e46f5a py_new_msg + 90\r\n19  telegram-cli                        0x0000000100e3b3bd print_message_gw + 45\r\n20  telegram-cli                        0x0000000100e6ca34 replay_log_event + 1460\r\n21  telegram-cli                        0x0000000100e6f06d add_log_event + 173\r\n22  telegram-cli                        0x0000000100e5f3af get_difference_on_answer + 671\r\n23  telegram-cli                        0x0000000100e5468d tglq_query_result + 685\r\n24  telegram-cli                        0x0000000100e50234 rpc_execute + 2212\r\n25  telegram-cli                        0x0000000100e74232 conn_try_read + 1058\r\n26  libevent-2.0.5.dylib                0x000000010e275b26 event_base_loop + 1788\r\n27  telegram-cli                        0x0000000100e2e332 net_loop + 178\r\n28  telegram-cli                        0x0000000100e30272 loop + 546\r\n29  telegram-cli                        0x0000000100e2e100 main + 784\r\n30  libdyld.dylib                       0x00007fff92b2f5fd start + 1\r\n31  ???                                 0x0000000000000003 0x0 + 3\r\nmac:tg luckydonald$\r\n```\r\n    \r\n###### Version\r\n```shell\r\nmac:tg luckydonald$ git log -1\r\ncommit 77cfd51d92bcaf49faf4a4fe9713078810b0a2fd\r\nAuthor: vvaltman <vvaltman@neon>\r\nDate:   Mon Jun 1 15:44:48 2015 +0300\r\n\r\n    fixed crash on empty photo\r\n```\r\n    \r\n###### System\r\n```shell\r\nmac:tg luckydonald$ uname -a\r\nDarwin mac.fritz.box 13.4.0 Darwin Kernel Version 13.4.0: Wed Dec 17 19:05:52 PST 2014; root:xnu-2422.115.10~1/RELEASE_X86_64 x86_64\r\n```\r\n   \r\n###### From **configure**:\r\n```shell\r\nchecking for python... enabled\r\nchecking for python build information...\r\nchecking for python3.4... python3.4\r\nchecking for main in -lpython3.4... no\r\nchecking for main in -lpython3.4m... no\r\nchecking for python3.3... no\r\nchecking for python3.2... no\r\nchecking for python3.1... no\r\nchecking for python3... python3\r\nchecking for main in -lpython3... no\r\nchecking for main in -lpython3m... no\r\nchecking for python2.7... python2.7\r\nchecking for main in -lpython2.7... yes\r\n  results of the Python check:\r\n    Binary:      python2.7\r\n    Library:     python2.7\r\n    Include Dir: /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7\r\n```"},"comment":{"url":"https://api.github.com/repos/vysheng/tg/issues/comments/108747049","html_url":"https://github.com/vysheng/tg/issues/587#issuecomment-108747049","issue_url":"https://api.github.com/repos/vysheng/tg/issues/587","id":108747049,"user":{"login":"luckydonald","id":2737108,"avatar_url":"https://avatars.githubusercontent.com/u/2737108?v=3","gravatar_id":"","url":"https://api.github.com/users/luckydonald","html_url":"https://github.com/luckydonald","followers_url":"https://api.github.com/users/luckydonald/followers","following_url":"https://api.github.com/users/luckydonald/following{/other_user}","gists_url":"https://api.github.com/users/luckydonald/gists{/gist_id}","starred_url":"https://api.github.com/users/luckydonald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luckydonald/subscriptions","organizations_url":"https://api.github.com/users/luckydonald/orgs","repos_url":"https://api.github.com/users/luckydonald/repos","events_url":"https://api.github.com/users/luckydonald/events{/privacy}","received_events_url":"https://api.github.com/users/luckydonald/received_events","type":"User","site_admin":false},"created_at":"2015-06-04T06:21:50Z","updated_at":"2015-06-04T06:21:50Z","body":"So python 3 Stoll crashes? Or doesn't it display the content any more?"}}