Closed roku-sics closed 8 years ago
Okay, so I think this may be an issue with the compiler version I have. I'm running (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6) and Python 2.7.8. I'm leaving this up because nowhere have I seen that I should use a certain gcc version so while I am going to try to use different versions, someone else may run into this issue.
What version do you recommend?
This is related to https://github.com/aitjcize/PyTox/issues/42
i do some work about new api, seems works fine. but need more test. https://github.com/kitech/PyTox/tree/newapi
@kitech Thank you for the work.
It compiles fine and I got it running after some sourcecode-changes.
One question, do you know how to save and load save_data?
save_to_file and load_from_file do not run anymore.
awesome! thanks for you work. Do you mind making a pull request?
OK, I cant get it: is save and load not implemented or did it change completely in the toxcore c implementation? How do I restart with the same id?
@merlink01 now you need call get_savedata_size and get_savedata, then save to file yourself for load, toxcore api support Tox_Options interface, so use ToxOptions.
class ToxOptions():
def __init__(self):
self.ipv6_enabled = True
self.udp_enabled = True
self.proxy_type = 0 # 1=http, 2=socks
self.proxy_host = ''
self.proxy_port = 0
self.start_port = 0
self.end_port = 0
self.tcp_port = 0
self.savedata_type = 0 # 1=toxsave, 2=secretkey
self.savedata_data = b''
self.savedata_length = 0
eg:
self.opts = ToxOptions()
self.opts.savedata_data = self.sets.getSaveData()
self.tox = ToxSlots(self.opts)
here ToxSlots inherient from Tox class. maybe ToxOptions can define as a PyObject class in c extension.
@aitjcize yes, of couse. may i PR to master, or new branch? maybe tag current master first?
@kitech Thank you very much.
Great work!!!
One Question left: If I try to start 2 instances (2 different python scripts) I get the following Message: pytox.OperationFailedError: failed to initialize toxcore Is it possible to realize that?
yes, PR onto master is fine, since the current master is broken because of the new API anyways.
the lastest commit fix 2+ instances bug. becuase of no clean hard port code.
Cool, I'll try the Fix.
Checked out latest Version: import pytox ImportError: /usr/lib/python2.7/site-packages/pytox.so: undefined symbol: PyUnicode_AsUTF8AndSize
sorry, update newapi branch and retry please.
Thats it, thank you.
Now multiple instances are running!
Any Idea how to get a filetransfer running?
Host A does:
def send_data(self,clientid, data): num = self.file_send(clientid, self.FILE_KIND_DATA, len(data), '0', 'test') self.file_send_chunk(clientid,num,0,data)
Host B gets the on_file_recv:
def on_file_recv(self, friend_number, file_number, seek,file_size, filename): print 'on_file_recv', friend_number, file_number, seek,file_size, filename print 'on_file_recv , friend_number, file_number, seek,file_size, filename' self.file_control(friend_number,file_number, self.FILE_CONTROL_RESUME)
and creates the control.
But instead of recieving something through:
def on_file_recv_chunk(self, *args): print args
I get:
pytox.OperationFailedError: tox_file_send_chunk() failed:5
Thanks Merlin
On host A: you need call file_send_chunk in on_file_chunk_request callback
Perfect, Thank you.
On Fedora with toxcore installed. No ToxAV, but I don't believe that's the problem.
Running 'python setup.py build' or install I receive the following error:
tox/core.c:2031:53: error: ‘TOX_FAERR_ALREADYSENT’ undeclared (first use in this function) PyDict_SetItemString(dict, #name, PyLongFromLong(TOX##name)); ^ tox/core.c:2037:3: note: in expansion of macro ‘SET’ SET(FAERR_ALREADYSENT) ^ tox/core.c:2031:53: error: ‘TOX_FAERR_UNKNOWN’ undeclared (first use in this function) PyDict_SetItemString(dict, #name, PyLongFromLong(TOX##name)); ^ tox/core.c:2038:3: note: in expansion of macro ‘SET’ SET(FAERR_UNKNOWN) ^ tox/core.c:2031:53: error: ‘TOX_FAERR_BADCHECKSUM’ undeclared (first use in this function) PyDict_SetItemString(dict, #name, PyLongFromLong(TOX##name)); ^ tox/core.c:2039:3: note: in expansion of macro ‘SET’ SET(FAERR_BADCHECKSUM) ^ tox/core.c:2031:53: error: ‘TOX_FAERR_SETNEWNOSPAM’ undeclared (first use in this function) PyDict_SetItemString(dict, #name, PyLongFromLong(TOX##name)); ^ tox/core.c:2040:3: note: in expansion of macro ‘SET’ SET(FAERR_SETNEWNOSPAM) ^ tox/core.c:2031:53: error: ‘TOX_FAERR_NOMEM’ undeclared (first use in this function) PyDict_SetItemString(dict, #name, PyLongFromLong(TOX##name)); ^ tox/core.c:2041:3: note: in expansion of macro ‘SET’ SET(FAERR_NOMEM) ^ tox/core.c:2031:53: error: ‘TOX_USERSTATUS_NONE’ undeclared (first use in this function) PyDict_SetItemString(dict, #name, PyLongFromLong(TOX##name)); ^ tox/core.c:2042:3: note: in expansion of macro ‘SET’ SET(USERSTATUS_NONE) ^ tox/core.c:2031:53: error: ‘TOX_USERSTATUS_AWAY’ undeclared (first use in this function) PyDict_SetItemString(dict, #name, PyLongFromLong(TOX##name)); ^ tox/core.c:2043:3: note: in expansion of macro ‘SET’ SET(USERSTATUS_AWAY) ^ tox/core.c:2031:53: error: ‘TOX_USERSTATUS_BUSY’ undeclared (first use in this function) PyDict_SetItemString(dict, #name, PyLongFromLong(TOX##name)); ^ tox/core.c:2044:3: note: in expansion of macro ‘SET’ SET(USERSTATUS_BUSY) ^ tox/core.c:2031:53: error: ‘TOX_USERSTATUS_INVALID’ undeclared (first use in this function) PyDict_SetItemString(dict, #name, PyLongFromLong(TOX##name)); ^ tox/core.c:2045:3: note: in expansion of macro ‘SET’ SET(USERSTATUS_INVALID) ^ tox/core.c:2031:53: error: ‘TOX_FILECONTROL_ACCEPT’ undeclared (first use in this function) PyDict_SetItemString(dict, #name, PyLongFromLong(TOX##name)); ^ tox/core.c:2049:3: note: in expansion of macro ‘SET’ SET(FILECONTROL_ACCEPT) ^ tox/core.c:2031:53: error: ‘TOX_FILECONTROL_PAUSE’ undeclared (first use in this function) PyDict_SetItemString(dict, #name, PyLongFromLong(TOX##name)); ^ tox/core.c:2050:3: note: in expansion of macro ‘SET’ SET(FILECONTROL_PAUSE) ^ tox/core.c:2031:53: error: ‘TOX_FILECONTROL_KILL’ undeclared (first use in this function) PyDict_SetItemString(dict, #name, PyLongFromLong(TOX##name)); ^ tox/core.c:2051:3: note: in expansion of macro ‘SET’ SET(FILECONTROL_KILL) ^ tox/core.c:2031:53: error: ‘TOX_FILECONTROL_FINISHED’ undeclared (first use in this function) PyDict_SetItemString(dict, #name, PyLongFromLong(TOX##name)); ^ tox/core.c:2052:3: note: in expansion of macro ‘SET’ SET(FILECONTROL_FINISHED) ^ tox/core.c:2031:53: error: ‘TOX_FILECONTROL_RESUME_BROKEN’ undeclared (first use in this function) PyDict_SetItemString(dict, #name, PyLongFromLong(TOX##name)); ^ tox/core.c:2053:3: note: in expansion of macro ‘SET’ SET(FILECONTROL_RESUME_BROKEN) ^ tox/core.c: In function ‘ToxCore_get_self_status_message’: tox/core.c:733:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ tox/core.c: In function ‘ToxCore_get_status_message’: tox/core.c:712:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ tox/core.c: In function ‘ToxCore_get_client_id’: tox/core.c:394:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ tox/core.c: In function ‘ToxCore_getaddress’: tox/core.c:264:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ error: command 'gcc' failed with exit status 1
Note this is only the snippet from the end becuase it is a massive wall of text. I had this running on my Debian box not long ago, and I don't know what could be wrong.
Note: If this is just some dumb error on my part, I apologize. Thank you for your time.