Page 1 of 1

[SOLVED] Error with readlines()

Published: January 16, 2025 - 11:13 AM
by Mugit
Good morning,

I'm trying to read a text file to retrieve information using this code

Code: Select all

chemin_txt=makepath("C:","Temp","Sup_fichiers.txt")
lignes = []
try :
    file  = open(chemin_txt,"r",encoding="utf8")
    print(file.readlines())
    lignes=file.readlines()
finally :
    file.close()
But I'm getting an error message

Code: Select all

2025-01-16 11:10:22,825 CRITICAL Error importing C:\waptdev\test_0_PROD-wapt\setup.py :
Traceback (most recent call last):
  File "C:\Program Files (x86)\wapt\waptutils.py", line 1608, in import_setup
    py_mod = imp.load_source(modulename, setupfilename)
  File "imp.py", line 171, in load_source
  File "<frozen importlib._bootstrap>", line 711, in _load
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 846, in exec_module
  File "<frozen importlib._bootstrap_external>", line 983, in get_code
  File "<frozen importlib._bootstrap_external>", line 913, in source_to_code
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\waptdev\test_0_PROD-wapt\setup.py", line 35
    chemin_txt=makepath("C:","Temp","Sup_fichiers.txt")
    ^
IndentationError: expected an indented block

FATAL ERROR : IndentationError: expected an indented block (setup.py, line 35)
Exit code:  3
Thanks in advance

Sincerely,
Brice

###############################

- Installed WAPT version 2.6.0
- Linux server OS and Debian version
- Operating system of the administration machine/Windows 11 package creation

Re: Error with readlines()

Published: January 16, 2025 - 11:27
by blemoigne
Hello Brice,
The lines above are missing to determine the necessary indentation.
Have a good day,
Bertrand

Re: Error with readlines()

Published: January 16, 2025 - 12:18 PM
by Mugit
Hello,

just variables and comments.

But I found my mistake; I hadn't inserted the line break. Sorry for creating the ticket for nothing.

Thank you in advance.

Best regards,
Brice.

################################

- Installed WAPT version: 2.6.0
- Server OS: Linux and Debian version
- Administration/package creation machine OS: Windows 11

Re: Error with readlines()

Published: January 16, 2025 - 3:08 PM
by dcardon
Hi Brice,

thanks for the feedback :-) . I'm marking the topic as resolved.

Denis