5.1.0 WidgetGen FileGenerator.py

9 views
Skip to first unread message

seasoned_geek

unread,
Jul 2, 2021, 7:58:25 PMJul 2
to scite-interest
All,

I got back to working on this late today and ran smack dab into this.

=====
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Architecture: amd64
'python' 'WidgetGen.py'
Traceback (most recent call last):
  File "WidgetGen.py", line 13, in <module>
    from FileGenerator import GenerateFile
  File "../../scripts/FileGenerator.py", line 171
    print(f"{path}:0: Can't find '{linePrefix}'")
                                               ^
SyntaxError: invalid syntax

CMAKE_SOURCE_DIR:                  /home/roland/sf_projects/roland_hughes-csscintilla/CSEdit
CMAKE_CURRENT_SOURCE_DIR:          /home/roland/sf_projects/roland_hughes-csscintilla/CSEdit
CSScintilla configured to run on:  Linux 64 bit, Release Mode
CSScintilla will be built in:      /home/roland/sf_projects/csscintilla_build
CSScintilla will be installed in:  /usr/lib

=====

It would sure help if the error message printed what it actually couldn't find and the file it couldn't find it in.

Let me say I do very little Python and try to avoid doing it no matter what.

Using Meld on Ubuntu 20.04 LTS (where I'm working on the CopperSpice port) shows this to be a shiny new if statement in FileGenerator.py.

Was that print statement supposed to look like one from this example?
====
import sys
print('This message will be displayed on the screen.')
with open('filename.txt', 'w') as f:
    print('This message will be written to a file.', file=f)
====

I assume there is something else I'm missing when diffing the directories in Meld but it is not jumping out at me. It could jump out at me if I knew what was being looked for in which file.

Any help would be appreciated.

Thanks in advance.





Neil Hodgson

unread,
Jul 2, 2021, 9:23:15 PMJul 2
to scite-interest
seasoned_geek:

> 'python' 'WidgetGen.py'
> Traceback (most recent call last):
> File "WidgetGen.py", line 13, in <module>
> from FileGenerator import GenerateFile
> File "../../scripts/FileGenerator.py", line 171
> print(f"{path}:0: Can't find '{linePrefix}'")
> ^
> SyntaxError: invalid syntax

Most likely due to using an older version of Python, probably 2.7, which doesn’t support f-strings (the ‘f’ before the double-quote), instead of 3.8. It may be possible to run Python 3.x with a “python3” command.

> It would sure help if the error message printed what it actually couldn't find and the file it couldn't find it in.

Yes, that is what it is trying to do.

While the code could be changed to work with Python 2.7, its likely that similar issues will occur next time its changed.

Neil

Reply all
Reply to author
Forward
0 new messages