Traceback (most recent call last):
File "/.../modules/blah.py", line 246, in OnPrivCTCPMessage
self.PutModule("ParamsColon 1: " + str(message.GetParamsColon(1)))
File "/.../znc/modpython/znc_core.py", line 3588, in GetParamsColon
return _znc_core.CMessage_GetParamsColon(self, uIdx, uLen)
TypeError: Wrong number or type of arguments for overloaded function 'CMessage_GetParamsColon'.
Possible C/C++ prototypes are:
CMessage::GetParamsColon(unsigned int,unsigned int) const
CMessage::GetParamsColon(unsigned int) const
Relevant lines in /.../znc/modpython/znc_core.py are as follows:
I don't know what the proper way is to resolve this. Regenerate SWIG? Fix the original class definition with a proper overload somehow? I leave it up to the experts. 😄
**Version**: 1.8.1
The API bindings appear unhappy in Python.
```
Traceback (most recent call last):
File "/.../modules/blah.py", line 246, in OnPrivCTCPMessage
self.PutModule("ParamsColon 1: " + str(message.GetParamsColon(1)))
File "/.../znc/modpython/znc_core.py", line 3588, in GetParamsColon
return _znc_core.CMessage_GetParamsColon(self, uIdx, uLen)
TypeError: Wrong number or type of arguments for overloaded function 'CMessage_GetParamsColon'.
Possible C/C++ prototypes are:
CMessage::GetParamsColon(unsigned int,unsigned int) const
CMessage::GetParamsColon(unsigned int) const
```
Relevant lines in `/.../znc/modpython/znc_core.py` are as follows:
```
def GetParamsColon(self, uIdx: 'unsigned int', uLen: 'unsigned int'=-1) -> "CString":
return _znc_core.CMessage_GetParamsColon(self, uIdx, uLen)
```
Clearly an unsigned int cannot be -1 (why that definition on C++ side anyways?!), so my guess is that some code (SWIG?) chokes on this.
I have tried setting `uLen` to None in the hope it would fall back to the 1-parameter version, but no dice.
Temporary workaround for anyone who needs the default for that parameter:
```
import _znc_core
self.PutModule("ParamsColon 1: " + str(_znc_core.CMessage_GetParamsColon(message, 1)))
```
I don't know what the proper way is to resolve this. Regenerate SWIG? Fix the original class definition with a proper overload somehow? I leave it up to the experts. 😄
<!-- github-sync-id:679579243 -->
It is pretty much in the traceback, which is why I didn't post it. It is just a global module, with the hook in it, and the line of the exception.
# paramcolonexample.pyimporttracebackimportzncclassparamcolonexample(znc.Module):description="Example python3 module that shows broken GetParamColon binding"# virtual EModRet CModule::OnPrivCTCPMessage ( CCTCPMessage& Message )defOnPrivCTCPMessage(self,message):try:self.PutModule("Broken binding test!")self.PutModule("ParamsColon: "+str(message.GetParamsColon(3)))exceptExceptionasex:self.PutModule("An error occurred while executing this command.")self.PutModule(''.join(traceback.format_exception(etype=type(ex),value=ex,tb=ex.__traceback__)))returnznc.CONTINUE
(Edited to add the return statement that is there in my code but forgotten about... but I might as well add it before someone is like 'you should put that in', because it is in there in reality. 😄 )
((And edited a second time because our conversation made me realize that you couldn't see the exception because znc loves swallowing uncaught exceptions.))
It is pretty much in the traceback, which is why I didn't post it. It is just a global module, with the hook in it, and the line of the exception.
```python
# paramcolonexample.py
import traceback
import znc
class paramcolonexample(znc.Module):
description = "Example python3 module that shows broken GetParamColon binding"
# virtual EModRet CModule::OnPrivCTCPMessage ( CCTCPMessage& Message )
def OnPrivCTCPMessage(self, message):
try:
self.PutModule("Broken binding test!")
self.PutModule("ParamsColon: " + str(message.GetParamsColon(3)))
except Exception as ex:
self.PutModule("An error occurred while executing this command.")
self.PutModule(''.join(traceback.format_exception(etype=type(ex), value=ex, tb=ex.__traceback__)))
return znc.CONTINUE
```
(Edited to add the return statement that is there in my code but forgotten about... but I might as well add it before someone is like 'you should put that in', because it is in there in reality. 😄 )
((And edited a second time because our conversation made me realize that you couldn't see the exception because znc loves swallowing uncaught exceptions.))
<!-- github-comment-id:674422625 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Version: 1.8.1
The API bindings appear unhappy in Python.
Relevant lines in
/.../znc/modpython/znc_core.pyare as follows:Clearly an unsigned int cannot be -1 (why that definition on C++ side anyways?!), so my guess is that some code (SWIG?) chokes on this.
I have tried setting
uLento None in the hope it would fall back to the 1-parameter version, but no dice.Temporary workaround for anyone who needs the default for that parameter:
I don't know what the proper way is to resolve this. Regenerate SWIG? Fix the original class definition with a proper overload somehow? I leave it up to the experts. 😄
Can you show your code?
It is pretty much in the traceback, which is why I didn't post it. It is just a global module, with the hook in it, and the line of the exception.
(Edited to add the return statement that is there in my code but forgotten about... but I might as well add it before someone is like 'you should put that in', because it is in there in reality. 😄 )
((And edited a second time because our conversation made me realize that you couldn't see the exception because znc loves swallowing uncaught exceptions.))