Re: recover pickled data: pickle data was truncated

2021-12-26 Thread Marco Sulla
Use a semaphore.

On Sun, 26 Dec 2021 at 03:30, iMath  wrote:
>
> Normally, the shelve data should be read and write by only one process at a 
> time, but unfortunately it was simultaneously read and write by two 
> processes, thus corrupted it. Is there any way to recover all data in it ? 
> Currently I just get "pickle data was truncated" exception after reading a 
> portion of the data?
>
> Data and code here 
> :https://drive.google.com/file/d/137nJFc1TvOge88EjzhnFX9bXg6vd0RYQ/view?usp=sharing
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


What's the public API alternative to _PyObject_GC_IS_TRACKED()?

2021-12-26 Thread Marco Sulla
I have to use _PyObject_GC_IS_TRACKED(). It can't be used unless you
define Py_BUILD_CORE. I want to avoid this. What macro or function can
substitute it?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What's the public API alternative to _PyObject_GC_IS_TRACKED()?

2021-12-26 Thread Barry Scott



> On 26 Dec 2021, at 13:48, Marco Sulla  wrote:
> 
> I have to use _PyObject_GC_IS_TRACKED(). It can't be used unless you
> define Py_BUILD_CORE. I want to avoid this. What macro or function can
> substitute it?

Why is this needed by your code? Surely the GC does its thing as an 
implementation detail of python.

Barry


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

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


Re: Uninstall old python version(Python 3.9.7)

2021-12-26 Thread Barry Scott


> On 25 Dec 2021, at 06:13, Công Huy  wrote:
> 
>   I had uninstalled Python 3.9.7 before but it wasn't uninstalled
>   completely. I found it still in my computer and when I click "uninstall",
>   it sent me a board "No Python 3.9 installation was detected". Of course,
>   it won't be an issue if it defaulted my main Python version on my computer
>   and I can't use some libraries I installed like numpy, matplotlib,
>   networkx,... To solve my python homework. I found some help on the
>   internet but it wasn't improved. I don't know how to fix it. Please help
>   me.

You seem to saying that you need 3.9, but you have removed it.
I'm guessing there is more going on then you have explained.
Otherwise simply reinstall python 3.9.

Barry

p.s. You signature contains an advert for outlook.
You might want to get rid of that.

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


A Newspaper for Python Mailing Lists

2021-12-26 Thread Abdur-Rahmaan Janhangeer
Greetings lists,

I have started a newspaper (not newsletter) focused
on interesting reads on Python mailing lists. Don't tag
on the fact that holiday seasons are the worst times for
launch according to marketing folks, I started this to note
down interesting mails. This might also be a great way to
bring mailing list gems to a wider readership. So, here's
the url https://pyherald.com/

Kind Regards,

Abdur-Rahmaan Janhangeer
about  | blog

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


Re: recover pickled data: pickle data was truncated

2021-12-26 Thread Barry Scott



> On 26 Dec 2021, at 13:44, Marco Sulla  wrote:
> 
> Use a semaphore.
> 
> On Sun, 26 Dec 2021 at 03:30, iMath  wrote:
>> 
>> Normally, the shelve data should be read and write by only one process at a 
>> time, but unfortunately it was simultaneously read and write by two 
>> processes, thus corrupted it. Is there any way to recover all data in it ? 
>> Currently I just get "pickle data was truncated" exception after reading a 
>> portion of the data?

You have lost the data in that case.

You will need to do what Marco suggests and lock access to the file.
How you do that depends your OS. If is unix OS then its likely you
will want to use fcntl.flock().

Barry

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