Re: KeyError: 'payload' while running core.py

2022-01-02 Thread Chris Angelico
On Mon, Jan 3, 2022 at 1:46 PM Đông Vũ  wrote:
>
> That is error, please help me fix it.
>
> Traceback (most recent call last):
>   File
> "C:\Users\vuduc\AppData\Local\Programs\Python\Python39\lib\site-packages\frida\core.py",
> line 450, in _on_message
> callback(message, data)
>   File "C:\NordLynx-main\nordlynx.py", line 43, in onMessage
> if 'PrivateKey' not in message["payload"]: return
> KeyError: 'payload'

The problem is with NordLynx, not Python.

> Signature powered by
> WiseStamp
> 

Quite impressive that a blank signature needs a "powered by" advertisement.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


KeyError: 'payload' while running core.py

2022-01-02 Thread Đông Vũ
That is error, please help me fix it.

Traceback (most recent call last):
  File
"C:\Users\vuduc\AppData\Local\Programs\Python\Python39\lib\site-packages\frida\core.py",
line 450, in _on_message
callback(message, data)
  File "C:\NordLynx-main\nordlynx.py", line 43, in onMessage
if 'PrivateKey' not in message["payload"]: return
KeyError: 'payload'

Signature powered by

WiseStamp

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: ModuleNotFoundError: No module named 'DistUtilsExtra'

2022-01-02 Thread hongy...@gmail.com
On Monday, January 3, 2022 at 6:15:53 AM UTC+8, Marco Sulla wrote:
> https://askubuntu.com/questions/584857/distutilsextra-problem

I found its Git repository using the following method:

$ for i in python-distutils-extra python3-distutils-extra; do apt showsrc $i |& 
grep git; done | sort -u
Vcs-Git: https://salsa.debian.org/python-team/modules/python-distutils-extra.git

Therefore, for developers, the more robust and reasonable pdfarranger 
installation steps should be as follows:

#https://github.com/pdfarranger/pdfarranger#install-from-source
$ sudo apt install gir1.2-gtk-3.0 gir1.2-poppler-0.18 
$ git clone https://github.com/pdfarranger/pdfarranger.git pdfarranger.git 
$ cd pdfarranger.git 
$ pyenv shell 3.8.3
$ pyenv virtualenv --system-site-packages pdfarranger
$ pyenv shell pdfarranger 
$ pip install -U pip
$ pip install 
git+https://salsa.debian.org/python-team/modules/python-distutils-extra.git
$ pip install img2pdf pygobject
$ pip install .

Another note: the python-distutils-extra or python3-distutils-extra is only a 
dependency in the installation process, once the package is installed, it will 
no longer be needed.

For a more detailed discussion, please see here [1].

[1] 
https://github.com/pdfarranger/pdfarranger/issues/604#issuecomment-1003801361

Regards,
HZ
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: ModuleNotFoundError: No module named 'DistUtilsExtra'

2022-01-02 Thread Marco Sulla
https://askubuntu.com/questions/584857/distutilsextra-problem

On Sun, 2 Jan 2022 at 18:52, hongy...@gmail.com  wrote:
>
> On Ubuntu 20.04.3 LTS, I try to install pdfarranger [1] as follows but failed:
>
> $ sudo apt-get install python3-pip python3-distutils-extra \
>   python3-wheel python3-gi 
> python3-gi-cairo \
>   gir1.2-gtk-3.0 gir1.2-poppler-0.18 
> python3-setuptools
> $ git clone https://github.com/pdfarranger/pdfarranger.git pdfarranger.git
> $ cd pdfarranger.git
> $ pyenv shell 3.8.3
> $ pyenv virtualenv --system-site-packages pdfarranger
> $ pyenv shell pdfarranger
> $ pip install -U pip
> $ ./setup.py build
> Traceback (most recent call last):
>   File "./setup.py", line 24, in 
> from DistUtilsExtra.command import (
> ModuleNotFoundError: No module named 'DistUtilsExtra'
>
>
> See the following for the package list installed in this virtualenv:
>
> $ pip list
> PackageVersion
> -- 
> pip21.3.1
> pyfiglet   0.8.post1
> setuptools 41.2.0
> vtk9.0.20200612
>
> Any hints for fixing this problem? Also see here [2-3] for relevant 
> discussions.
>
> [1] https://github.com/pdfarranger/pdfarranger
> [2] https://github.com/pdfarranger/pdfarranger/issues/604
> [3] 
> https://discuss.python.org/t/modulenotfounderror-no-module-named-distutilsextra/12834
>
> Regards,
> HZ
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


ModuleNotFoundError: No module named 'DistUtilsExtra'

2022-01-02 Thread hongy...@gmail.com
On Ubuntu 20.04.3 LTS, I try to install pdfarranger [1] as follows but failed:

$ sudo apt-get install python3-pip python3-distutils-extra \
  python3-wheel python3-gi python3-gi-cairo 
\
  gir1.2-gtk-3.0 gir1.2-poppler-0.18 
python3-setuptools
$ git clone https://github.com/pdfarranger/pdfarranger.git pdfarranger.git
$ cd pdfarranger.git
$ pyenv shell 3.8.3
$ pyenv virtualenv --system-site-packages pdfarranger
$ pyenv shell pdfarranger 
$ pip install -U pip
$ ./setup.py build
Traceback (most recent call last):
  File "./setup.py", line 24, in 
from DistUtilsExtra.command import (
ModuleNotFoundError: No module named 'DistUtilsExtra'


See the following for the package list installed in this virtualenv:

$ pip list 
PackageVersion
-- 
pip21.3.1
pyfiglet   0.8.post1
setuptools 41.2.0
vtk9.0.20200612

Any hints for fixing this problem? Also see here [2-3] for relevant discussions.

[1] https://github.com/pdfarranger/pdfarranger
[2] https://github.com/pdfarranger/pdfarranger/issues/604
[3] 
https://discuss.python.org/t/modulenotfounderror-no-module-named-distutilsextra/12834

Regards,
HZ
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Who wrote Py_UNREACHABLE?

2022-01-02 Thread Barry Scott



> On 2 Jan 2022, at 16:17, Marco Sulla  wrote:
> 
> #if defined(RANDALL_WAS_HERE)
> #  define Py_UNREACHABLE() \
>Py_FatalError( \
>"If you're seeing this, the code is in what I thought was\n" \
>"an unreachable state.\n\n" \
>"I could give you advice for what to do, but honestly, why\n" \
>"should you trust me?  I clearly screwed this up.  I'm writing\n" \
>"a message that should never appear, yet I know it will\n" \
>"probably appear someday.\n\n" \
>"On a deep level, I know I'm not up to this task.\n" \
>"I'm so sorry.\n" \
>"https://xkcd.com/2200";)
> #elif defined(Py_DEBUG)
> #  define Py_UNREACHABLE() \
>Py_FatalError( \
>"We've reached an unreachable state. Anything is possible.\n" \
>"The limits were in our heads all along. Follow your dreams.\n" \
>"https://xkcd.com/2200";)

use git blame to find out the commit then use git log to read the commit 
message.

Barry


> 
> etc
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Who wrote Py_UNREACHABLE?

2022-01-02 Thread Chris Angelico
On Mon, Jan 3, 2022 at 3:19 AM Marco Sulla  wrote:
>
> #if defined(RANDALL_WAS_HERE)
> #  define Py_UNREACHABLE() \
> Py_FatalError( \
> "If you're seeing this, the code is in what I thought was\n" \
> "an unreachable state.\n\n" \
> "I could give you advice for what to do, but honestly, why\n" \
> "should you trust me?  I clearly screwed this up.  I'm writing\n" \
> "a message that should never appear, yet I know it will\n" \
> "probably appear someday.\n\n" \
> "On a deep level, I know I'm not up to this task.\n" \
> "I'm so sorry.\n" \
> "https://xkcd.com/2200";)
> #elif defined(Py_DEBUG)
> #  define Py_UNREACHABLE() \
> Py_FatalError( \
> "We've reached an unreachable state. Anything is possible.\n" \
> "The limits were in our heads all along. Follow your dreams.\n" \
> "https://xkcd.com/2200";)
>
> etc

Zachary Ware, 2019-09-12, commit #3ab614
https://github.com/python/cpython/pull/16032

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Who wrote Py_UNREACHABLE?

2022-01-02 Thread Marco Sulla
#if defined(RANDALL_WAS_HERE)
#  define Py_UNREACHABLE() \
Py_FatalError( \
"If you're seeing this, the code is in what I thought was\n" \
"an unreachable state.\n\n" \
"I could give you advice for what to do, but honestly, why\n" \
"should you trust me?  I clearly screwed this up.  I'm writing\n" \
"a message that should never appear, yet I know it will\n" \
"probably appear someday.\n\n" \
"On a deep level, I know I'm not up to this task.\n" \
"I'm so sorry.\n" \
"https://xkcd.com/2200";)
#elif defined(Py_DEBUG)
#  define Py_UNREACHABLE() \
Py_FatalError( \
"We've reached an unreachable state. Anything is possible.\n" \
"The limits were in our heads all along. Follow your dreams.\n" \
"https://xkcd.com/2200";)

etc
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: recover pickled data: pickle data was truncated

2022-01-02 Thread Barry Scott


> On 1 Jan 2022, at 16:13, Marco Sulla  wrote:
> 
> I agree with Barry. You can create a folder or a file with
> pseudo-random names. I recommend you to use str(uuid.uuid4())

At work and personally I use iso-8601 timestamps to make the files unique and 
easy to
find out when they where created.

:>>> t = datetime.datetime.now()
:>>> t
datetime.datetime(2022, 1, 2, 12, 34, 1, 267935)
:>>> t.strftime('%Y-%m-%dT%H-%M-%S')
'2022-01-02T12-34-01'
:>>>

That is good enough as long as you create the files slower than once a second.

Oh and yes use JSON, it is far better as a way of exchanging data than pickle.
Easy to read and check, can be processes in many languages.

Barry


> 
> On Sat, 1 Jan 2022 at 14:11, Barry  wrote:
>> 
>> 
>> 
>>> On 31 Dec 2021, at 17:53, iMath  wrote:
>>> 
>>> 在 2021年12月30日星期四 UTC+8 03:13:21, 写道:
> On Wed, 29 Dec 2021 at 18:33, iMath  wrote:
> But I found the size of the file of the shelve data didn't change much, 
> so I guess the data are still in it , I just wonder any way to recover my 
> data.
 I agree with Barry, Chris and Avi. IMHO your data is lost. Unpickling
 it by hand is a harsh work and maybe unreliable.
 
 Is there any reason you can't simply add a semaphore to avoid writing
 at the same time and re-run the code and regenerate the data?
>>> 
>>> Thanks for your replies! I didn't have a sense of adding a semaphore on 
>>> writing to pickle data before, so  corrupted the data.
>>> Since my data was colleted in the daily usage, so cannot re-run the code 
>>> and regenerate the data.
>>> In order to avoid corrupting my data again and the complicity of using  a 
>>> semaphore, now I am using json text to store my data.
>> 
>> That will not fix the problem. You will end up with corrupt json.
>> 
>> If you have one writer and one read then may be you can use the fact that a 
>> rename is atomic.
>> 
>> Writer does this:
>> 1. Creat new json file in the same folder but with a tmp name
>> 2. Rename the file from its tmp name to the public name.
>> 
>> The read will just read the public name.
>> 
>> I am not sure what happens in your world if the writer runs a second time 
>> before the data is read.
>> 
>> In that case you need to create a queue of files to be read.
>> 
>> But if the problem is two process racing against each other you MUST use 
>> locking.
>> It cannot be avoided for robust operations.
>> 
>> Barry
>> 
>> 
>>> --
>>> https://mail.python.org/mailman/listinfo/python-list
>> 
>> --
>> https://mail.python.org/mailman/listinfo/python-list
> 

-- 
https://mail.python.org/mailman/listinfo/python-list