Skip to content

Conversation

@Belfagor2005
Copy link
Contributor

The code used the Python 2 cmp() function, which doesn't exist in Python 3.
Fix: Replaced with functools.cmp_to_key() or key functions for sort().
'<' not supported between instances of 'str' and 'float'.
Problem: The byDateFunc() function sometimes returned a float (timestamp) and sometimes a string (fallback to name).
Fix: Used a tuple (priority, value) to ensure consistent sorting:
(0, timestamp) for elements with a valid date.
(1, name) for elements without a date.

Il codice usava la funzione cmp() di Python 2 che non esiste in Python 3
Fix: Sostituito con functools.cmp_to_key() oppure con funzioni key per sort()
'<' not supported between instances of 'str' and 'float'
Problema: La funzione byDateFunc() restituiva a volte float (timestamp) e a volte string (fallback su nome)
Fix: Usato una tupla (priority, value) per garantire ordinamento coerente:
(0, timestamp) per elementi con data valida
(1, nome) per elementi senza data
@Hains
Copy link
Member

Hains commented Dec 27, 2025

Where is cmp() ? What is the actually fix? Seems a copy/pase from OE-A (but I could be wrong).

@Belfagor2005
Copy link
Contributor Author

you have right..
i change cmp with correct code..
I tested on last openpli9 and all work same.
i pul new code ..
wait

@Belfagor2005
Copy link
Contributor Author

for me work..
actrual fix compare..
On 1 message are

The code used the Python 2 cmp() function, which doesn't exist in Python 3.
Fix: Replaced with functools.cmp_to_key() or key functions for sort().
'<' not supported between instances of 'str' and 'float'.
Problem: The byDateFunc() function sometimes returned a float (timestamp) and sometimes a string (fallback to name).
Fix: Used a tuple (priority, value) to ensure consistent sorting:
(0, timestamp) for elements with a valid date.
(1, name) for elements without a date.

thank's

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants