Error on send message via API #1898

Closed
opened 2021-12-10 19:06:37 +01:00 by teruteru128 · 22 comments
teruteru128 commented 2021-12-10 19:06:37 +01:00 (Migrated from github.com)

If you send a message to an address registered in the address book via API, an error will be returned.

2021-12-11 02:50:58,436 - ERROR - too many values to unpack
Traceback (most recent call last):
  File "api.py", line 1514, in _dispatch
  File "api.py", line 1487, in _handle_request
  File "api.py", line 1137, in HandleSendMessage
ValueError: too many values to unpack

OS: Windows 10 21H1
PyBitmessage: 0.6.3.2 20211207

If you send a message to an address registered in the address book via API, an error will be returned. ```log 2021-12-11 02:50:58,436 - ERROR - too many values to unpack Traceback (most recent call last): File "api.py", line 1514, in _dispatch File "api.py", line 1487, in _handle_request File "api.py", line 1137, in HandleSendMessage ValueError: too many values to unpack ``` OS: Windows 10 21H1 PyBitmessage: 0.6.3.2 20211207
g1itch commented 2021-12-10 19:08:37 +01:00 (Migrated from github.com)

Could I see your code?

Could I see your code?
teruteru128 commented 2021-12-10 19:10:46 +01:00 (Migrated from github.com)

The first thing you can prepare is written in C, is that okay?

The first thing you can prepare is written in C, is that okay?
g1itch commented 2021-12-10 19:17:10 +01:00 (Migrated from github.com)

The first thing you can prepare is written in C, is that okay?

I'm not afraid (;

The line number of your traceback seems to point to decoding of base64 in subject argument

> The first thing you can prepare is written in C, is that okay? I'm not afraid (; The line number of your traceback seems to point to decoding of base64 in subject argument
teruteru128 commented 2021-12-10 19:17:42 +01:00 (Migrated from github.com)
https://github.com/teruteru128/study/blob/develop/src/bmsendmsg.c https://github.com/teruteru128/libstudy/blob/master/src/bmapi.c
teruteru128 commented 2021-12-10 19:23:08 +01:00 (Migrated from github.com)

Hmm ... should I submit something made with python?
I think it's probably not difficult because it depends on whether there is a corresponding record in the address book using the XML-RPC API.

Hmm ... should I submit something made with python? I think it's probably not difficult because it depends on whether there is a corresponding record in the address book using the XML-RPC API.
g1itch commented 2021-12-10 19:25:24 +01:00 (Migrated from github.com)

The line number of your traceback seems to point to decoding of base64 in subject argument

Oh, I see it's really about the label: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/api.py#L1137

> The line number of your traceback seems to point to decoding of base64 in subject argument Oh, I see it's really about the label: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/api.py#L1137
g1itch commented 2021-12-10 19:31:16 +01:00 (Migrated from github.com)

Hmm ... should I submit something made with python? I think it's probably not difficult because it depends on whether there is a corresponding record in the address book using the XML-RPC API.

Yes, if you can reproduce it in python. Don't you get this exception when using JSON-RPC? It seems not related.

> Hmm ... should I submit something made with python? I think it's probably not difficult because it depends on whether there is a corresponding record in the address book using the XML-RPC API. Yes, if you can reproduce it in python. Don't you get this exception when using JSON-RPC? It seems not related.
g1itch commented 2021-12-10 19:35:36 +01:00 (Migrated from github.com)

Perhaps try to remove the comma in the line. Does it help?

Пт, 10 груд. 2021 20:23 користувач Teruteru @.***> пише:

Hmm ... should I submit something made with python?
I think it's probably not difficult because it depends on whether there is
a corresponding record in the address book using the XML-RPC API.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Bitmessage/PyBitmessage/issues/1898#issuecomment-991194843,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AA6TVHCMMBA4ZFVNGXXTS5DUQJARPANCNFSM5JZW46PQ
.
Triage notifications on the go with GitHub Mobile for iOS
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
or Android
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Perhaps try to remove the comma in the line. Does it help? Пт, 10 груд. 2021 20:23 користувач Teruteru ***@***.***> пише: > Hmm ... should I submit something made with python? > I think it's probably not difficult because it depends on whether there is > a corresponding record in the address book using the XML-RPC API. > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <https://github.com/Bitmessage/PyBitmessage/issues/1898#issuecomment-991194843>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AA6TVHCMMBA4ZFVNGXXTS5DUQJARPANCNFSM5JZW46PQ> > . > Triage notifications on the go with GitHub Mobile for iOS > <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> > or Android > <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>. > >
teruteru128 commented 2021-12-10 19:45:51 +01:00 (Migrated from github.com)

Um ... I'm sorry, I'm using PyBitmessage distributed as a binary on Windows, so I can't modify the source code and test it right away.

Um ... I'm sorry, I'm using PyBitmessage distributed as a binary on Windows, so I can't modify the source code and test it right away.
teruteru128 commented 2021-12-10 19:46:59 +01:00 (Migrated from github.com)

However, the indication of removing the comma seems correct.

However, the indication of removing the comma seems correct.
g1itch commented 2021-12-10 19:49:28 +01:00 (Migrated from github.com)

OK, so I have to write a test and merge the fix or at least build a new
continuous release. Maybe tomorrow.

Пт, 10 груд. 2021 20:46 користувач Teruteru @.***> пише:

Um ... I'm sorry, I'm using PyBitmessage distributed as a binary on
Windows, so I can't modify the source code and test it right away.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Bitmessage/PyBitmessage/issues/1898#issuecomment-991210366,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AA6TVHASNI67VHCOH4XSHJTUQJDGVANCNFSM5JZW46PQ
.
Triage notifications on the go with GitHub Mobile for iOS
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
or Android
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

OK, so I have to write a test and merge the fix or at least build a new continuous release. Maybe tomorrow. Пт, 10 груд. 2021 20:46 користувач Teruteru ***@***.***> пише: > Um ... I'm sorry, I'm using PyBitmessage distributed as a binary on > Windows, so I can't modify the source code and test it right away. > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <https://github.com/Bitmessage/PyBitmessage/issues/1898#issuecomment-991210366>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AA6TVHASNI67VHCOH4XSHJTUQJDGVANCNFSM5JZW46PQ> > . > Triage notifications on the go with GitHub Mobile for iOS > <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> > or Android > <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>. > >
teruteru128 commented 2021-12-10 20:18:18 +01:00 (Migrated from github.com)
The source code has been updated. I think this makes it easier to see. https://github.com/teruteru128/study/blob/9324573/src/bmsendmsg.c https://github.com/teruteru128/libstudy/blob/d3475a2/src/bmapi.c#L88-L126
PeterSurda commented 2021-12-11 02:20:28 +01:00 (Migrated from github.com)

The ValueError is confusing me. However I was able to reproduce a scaled down version of the exception, maybe it will help (I don't have more time at the moment to look into it).

>>> r = [[[0, 0, 0], 0, 0]]
>>> toLabel, = r[0][0]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: too many values to unpack

If I had to take a wild guess, I would say there are duplicate records in the address book, or the label column is stored in an unusual storage type (a BLOB instead of a TEXT, maybe). This type of problem should still be handled better in PyBM though.

The `ValueError` is confusing me. However I was able to reproduce a scaled down version of the exception, maybe it will help (I don't have more time at the moment to look into it). ``` >>> r = [[[0, 0, 0], 0, 0]] >>> toLabel, = r[0][0] Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: too many values to unpack ``` If I had to take a wild guess, I would say there are duplicate records in the address book, or the `label` column is stored in an unusual storage type (a `BLOB` instead of a `TEXT`, maybe). This type of problem should still be handled better in PyBM though.
g1itch commented 2021-12-11 02:44:34 +01:00 (Migrated from github.com)

Try bytes:
toLabel = b'test'

Сб, 11 груд. 2021 03:20 користувач Peter Šurda @.***>
пише:

The ValueError is confusing me. However I was able to reproduce a scaled
down version of the exception, maybe it will help (I don't have more time
at the moment to look into it).

r = [0, 0, 0], 0, 0
toLabel, = r[0][0]
Traceback (most recent call last):
File "", line 1, in
ValueError: too many values to unpack

If I had to take a wild guess, I would say there are duplicate records in
the address book, or the label column is stored in an unusual storage
type (a blob instead of a string, maybe). This type of problem should still
be handled better in PyBM though.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Bitmessage/PyBitmessage/issues/1898#issuecomment-991401902,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AA6TVHFBX7N3NUTAA6XKI6DUQKROPANCNFSM5JZW46PQ
.
Triage notifications on the go with GitHub Mobile for iOS
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
or Android
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Try bytes: toLabel = b'test' Сб, 11 груд. 2021 03:20 користувач Peter Šurda ***@***.***> пише: > The ValueError is confusing me. However I was able to reproduce a scaled > down version of the exception, maybe it will help (I don't have more time > at the moment to look into it). > > >>> r = [[[0, 0, 0], 0, 0]] > >>> toLabel, = r[0][0] > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > ValueError: too many values to unpack > > If I had to take a wild guess, I would say there are duplicate records in > the address book, or the label column is stored in an unusual storage > type (a blob instead of a string, maybe). This type of problem should still > be handled better in PyBM though. > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <https://github.com/Bitmessage/PyBitmessage/issues/1898#issuecomment-991401902>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AA6TVHFBX7N3NUTAA6XKI6DUQKROPANCNFSM5JZW46PQ> > . > Triage notifications on the go with GitHub Mobile for iOS > <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> > or Android > <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>. > >
PeterSurda commented 2021-12-11 03:58:37 +01:00 (Migrated from github.com)

Try bytes: toLabel = b'test'

Yep looks like you're right:

>>> r = [[b'sldfkjas']]
>>> toLabel, = r[0][0]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: too many values to unpack
> Try bytes: `toLabel = b'test'` Yep looks like you're right: ``` >>> r = [[b'sldfkjas']] >>> toLabel, = r[0][0] Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: too many values to unpack ```
PeterSurda commented 2021-12-11 08:35:47 +01:00 (Migrated from github.com)

Well the same happens with a string, makes sense for python2. So the comma shouldn't be there, it's a bug.

Well the same happens with a string, makes sense for python2. So the comma shouldn't be there, it's a bug.
g1itch commented 2021-12-11 15:44:05 +01:00 (Migrated from github.com)

OK, so I have to write a test and merge the fix or at least build a new continuous release. Maybe tomorrow.

The test is written, the fix is already available on my continuous release page. Note, it's built in slightly different way than official ones.

> OK, so I have to write a test and merge the fix or at least build a new continuous release. Maybe tomorrow. The test is written, the fix is already available on my [continuous release page](https://github.com/g1itch/PyBitmessage/releases/tag/continuous). Note, it's built in slightly different way than official ones.
teruteru128 commented 2021-12-11 16:24:33 +01:00 (Migrated from github.com)

OK, so I have to write a test and merge the fix or at least build a new continuous release. Maybe tomorrow.

The test is written, the fix is already available on my continuous release page. Note, it's built in slightly different way than official ones.

I was able to confirm that the problem was fixed! 👍

> > OK, so I have to write a test and merge the fix or at least build a new continuous release. Maybe tomorrow. > > The test is written, the fix is already available on my [continuous release page](https://github.com/g1itch/PyBitmessage/releases/tag/continuous). Note, it's built in slightly different way than official ones. I was able to confirm that the problem was fixed! :thumbsup:
g1itch commented 2021-12-11 16:37:04 +01:00 (Migrated from github.com)

The test is written, the fix is already available on my continuous release page. Note, it's built in slightly different way than official ones.

I was able to confirm that the problem was fixed! +1

So, let's wait for merging of #1899. Thank you for report! It's been a while since the API refactoring.

> > The test is written, the fix is already available on my [continuous release page](https://github.com/g1itch/PyBitmessage/releases/tag/continuous). Note, it's built in slightly different way than official ones. > > I was able to confirm that the problem was fixed! +1 So, let's wait for merging of #1899. Thank you for report! It's been a while since the API refactoring.
teruteru128 commented 2021-12-13 08:26:09 +01:00 (Migrated from github.com)

@g1itch

OK, so I have to write a test and merge the fix or at least build a new continuous release. Maybe tomorrow.

The test is written, the fix is already available on my continuous release page. Note, it's built in slightly different way than official ones.

Hi, I've tried this unofficial release, but it doesn't seem that jsonapi is available. Should I create a new issue?

2021-12-13 15:39:08,928 - WARNING - defusedxml not available, only use API on a secure, closed network.
2021-12-13 15:39:08,928 - WARNING - jsonrpclib not available, failing back to XML-RPC
@g1itch > > OK, so I have to write a test and merge the fix or at least build a new continuous release. Maybe tomorrow. > > The test is written, the fix is already available on my [continuous release page](https://github.com/g1itch/PyBitmessage/releases/tag/continuous). Note, it's built in slightly different way than official ones. Hi, I've tried this unofficial release, but it doesn't seem that jsonapi is available. Should I create a new issue? ```log 2021-12-13 15:39:08,928 - WARNING - defusedxml not available, only use API on a secure, closed network. 2021-12-13 15:39:08,928 - WARNING - jsonrpclib not available, failing back to XML-RPC ```
teruteru128 commented 2021-12-13 09:25:10 +01:00 (Migrated from github.com)

@g1itch

OK, so I have to write a test and merge the fix or at least build a new continuous release. Maybe tomorrow.

The test is written, the fix is already available on my continuous release page. Note, it's built in slightly different way than official ones.

Hi, I've tried this unofficial release, but it doesn't seem that jsonapi is available. Should I create a new issue?

2021-12-13 15:39:08,928 - WARNING - defusedxml not available, only use API on a secure, closed network.
2021-12-13 15:39:08,928 - WARNING - jsonrpclib not available, failing back to XML-RPC

I have confirmed that the same issue occurs with the officially released snapshot binaries.
https://download.bitmessage.org/snapshots/20211207/

> @g1itch > > > > OK, so I have to write a test and merge the fix or at least build a new continuous release. Maybe tomorrow. > > > > > > The test is written, the fix is already available on my [continuous release page](https://github.com/g1itch/PyBitmessage/releases/tag/continuous). Note, it's built in slightly different way than official ones. > > Hi, I've tried this unofficial release, but it doesn't seem that jsonapi is available. Should I create a new issue? > > ``` > 2021-12-13 15:39:08,928 - WARNING - defusedxml not available, only use API on a secure, closed network. > 2021-12-13 15:39:08,928 - WARNING - jsonrpclib not available, failing back to XML-RPC > ``` I have confirmed that the same issue occurs with the officially released snapshot binaries. https://download.bitmessage.org/snapshots/20211207/
PeterSurda commented 2021-12-13 09:38:03 +01:00 (Migrated from github.com)

Hi, I've tried this unofficial release, but it doesn't seem that jsonapi is available. Should I create a new issue?

2021-12-13 15:39:08,928 - WARNING - defusedxml not available, only use API on a secure, closed network.
2021-12-13 15:39:08,928 - WARNING - jsonrpclib not available, failing back to XML-RPC

I have confirmed that the same issue occurs with the officially released snapshot binaries. https://download.bitmessage.org/snapshots/20211207/

Thank you I'll open a separate issue for this.

> > Hi, I've tried this unofficial release, but it doesn't seem that jsonapi is available. Should I create a new issue? > > ``` > > 2021-12-13 15:39:08,928 - WARNING - defusedxml not available, only use API on a secure, closed network. > > 2021-12-13 15:39:08,928 - WARNING - jsonrpclib not available, failing back to XML-RPC > > ``` > > I have confirmed that the same issue occurs with the officially released snapshot binaries. https://download.bitmessage.org/snapshots/20211207/ Thank you I'll open a separate issue for this.
This repo is archived. You cannot comment on issues.
No Milestone
No project
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Bitmessage/PyBitmessage-2024-12-21#1898
No description provided.