pylupdate6 fails under Python 3.14
Phil Thompson
phil at riverbankcomputing.com
Sat Nov 1 12:12:53 GMT 2025
On 31/10/2025 09:57, Detlev Offenbach wrote:
> Am 31.10.25 um 10:53 schrieb Marko Luther:
>> There seems to be a problem running pylupdate6 under Python 3.14
>>
>> ....
>> File
>> "/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/ast.py",
>> line 506, in visit
>> return visitor(node)
>> File
>> "/Users/luther/Documents/Projects/Artisan/Repository/artisan/.venv14u/lib/python3.14/site-packages/PyQt6/lupdate/python_source.py",
>> line 166, in visit_Call
>> call_args = self._parse_translate(node)
>> File
>> "/Users/luther/Documents/Projects/Artisan/Repository/artisan/.venv14u/lib/python3.14/site-packages/PyQt6/lupdate/python_source.py",
>> line 292, in _parse_translate
>> name = self._get_first_str(node.args)
>> File
>> "/Users/luther/Documents/Projects/Artisan/Repository/artisan/.venv14u/lib/python3.14/site-packages/PyQt6/lupdate/python_source.py",
>> line 207, in _get_first_str
>> return cls._get_str(args[0])
>> ~~~~~~~~~~~~^^^^^^^^^
>> File
>> "/Users/luther/Documents/Projects/Artisan/Repository/artisan/.venv14u/lib/python3.14/site-packages/PyQt6/lupdate/python_source.py",
>> line 227, in _get_str
>> if isinstance(node, ast.Str):
>> ^^^^^^^
>> AttributeError: module 'ast' has no attribute 'Str'
>>
>>
>> Seems that ast.Str was removed from Python3.14 and should be replaced
>> by ast.Constant and attribute s by value. Thus I replaced the lines
>>
>> if isinstance(node, ast.Str):
>> return node.s
>>
>> in python_source.py by
>>
>> if isinstance(node, ast.Constant):
>> return node.value
> I think you have to check for 'isinstance(node.value, str)' because
> there are some more older AST types that are now 'ast.Constant' (e.g.
> ast.NUM).
>>
>> and this seems to work.
>>
>> This using the latest PyQt/Qt from pypip.
>>
>> Best,
>> Marko
I think it is safe to just remove the 'if' statement. I think Python
v3.7 was the latest version it was needed.
Thanks,
Phil
More information about the PyQt
mailing list