[Bug] Broken Linux symlink crashes Demo_Tree_Element.py
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 48/100
Línea de trabajo
Comienza con Demo_Tree_Element.py, especialmente con la línea 36, donde se usa os.stat(fullname) al insertar archivos en el árbol. Reproduce el problema usando un directorio que contenga un enlace simbólico roto; se considera completado cuando la demo ya no se bloquea y la entrada afectada se gestiona de forma visible en el árbol.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Type of Issue (Enhancement, Error, Bug, Question)
[Bug] Broken Linux symlink crashes Demo_Tree_Element.py
When running the program against a directory tree that contains a broken file symbolic link, it crashes with a "file not found" error. Python throws an exception that isn't handled:
Traceback (most recent call last):
File "Demo_Tree_Element.py", line 38, in
add_files_in_folder('', starting_path)
File "Demo_Tree_Element.py", line 34, in add_files_in_folder
add_files_in_folder(fullname, fullname)
File "Demo_Tree_Element.py", line 34, in add_files_in_folder
add_files_in_folder(fullname, fullname)
File "Demo_Tree_Element.py", line 36, in add_files_in_folder
treedata.Insert(parent, fullname, f, values=[os.stat(fullname).st_size], icon=file_icon)
FileNotFoundError: [Errno 2] No such file or directory: '/home/ran/projects/net_tools/samplicator-master/depcomp'
This was obvious when I ran it from the command line, but from the Demo Browser it just silently disappeared
Operating System
Ubuntu 20.04
PySimpleGUI Port (tkinter, Qt, Wx, Web)
print(sg)
<module 'PySimpleGUI' from '/usr/local/lib/python3.8/dist-packages/PySimpleGUI/init.py'>
(sg.version)
'4.60.5 Released 21-May-2023'
Versions
*** Version information copied to your clipboard. Paste into your GitHub Issue. ***
Python version: 3.8.10 (default, May 26 2023, 14:05:08)
[GCC 9.4.0]
port: tkinter
tkinter version: 8.6.10
PySimpleGUI version: 4.60.5
PySimpleGUI filename: /usr/local/lib/python3.8/dist-packages/PySimpleGUI/PySimpleGUI.py
Version information can be obtained by calling sg.main_get_debug_data()
Or you can print each version shown in ()
Python version (sg.sys.version)
'3.8.10 (default, May 26 2023, 14:05:08) \n[GCC 9.4.0]'
PySimpleGUI Version (sg.__version__)
'4.60.5'
GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi)
tkinter
Your Experience In Months or Years (optional)
Years Python programming experience 2
Years Programming experience overall 54
Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine)
Anything else you think would be helpful?
Troubleshooting
These items may solve your problem. Please check those you've done by changing - [ ] to - [X]
- Searched main docs for your problem www.PySimpleGUI.org
- Looked for Demo Programs that are similar to your goal. It is recommend you use the Demo Browser! Demos.PySimpleGUI.org
- None of your GUI code was generated by an AI algorithm like GPT
- If not tkinter - looked for Demo Programs for specific port
- For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
- Run your program outside of your debugger (from a command line)
- Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org
- Have upgraded to the latest release of PySimpleGUI on PyPI (lastest official version)
- Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released
Detailed Description
When running the program against a directory tree that contains a broken file symbolic link, it crashes with a "file not found" error. Python throws an exception that isn't handled:
Traceback (most recent call last):
File "Demo_Tree_Element.py", line 38, in
add_files_in_folder('', starting_path)
File "Demo_Tree_Element.py", line 34, in add_files_in_folder
add_files_in_folder(fullname, fullname)
File "Demo_Tree_Element.py", line 34, in add_files_in_folder
add_files_in_folder(fullname, fullname)
File "Demo_Tree_Element.py", line 36, in add_files_in_folder
treedata.Insert(parent, fullname, f, values=[os.stat(fullname).st_size], icon=file_icon)
FileNotFoundError: [Errno 2] No such file or directory: '/home/ran/projects/net_tools/samplicator-master/depcomp'
This was obvious when I ran it from the command line, but from the Demo Browser it just silently disappeared
Code To Duplicate
The Demo_Tree_Element.py file included with the package.
This pre-formatted code block is all set for you to paste in your bit of code:
# Paste your code here
To fix, replace line 36 with something like:
try:
treedata.Insert(parent, fullname, f, values=[os.stat(fullname).st_size], icon=file_icon)
except:
treedata.Insert(parent, fullname, f, values=["???? error"], icon=file_icon)
Screenshot, Sketch, or Drawing
Watcha Makin?
If you care to share something about your project, it would be awesome to hear what you're building.
- Lenguaje dominante
- Python
- Estrellas
- 13.8k
- Forks
- 1.8k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PySimpleGUI/PySimpleGUI
-
Bug Done - Install Dev Build (see docs for how) Platform Specific Issue - Linux Port - TK
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
PySimpleGUI/PySimpleGUI#6904 · 15 comentarios ·
-
Bug Demo Programs Done - Install Dev Build (see docs for how) Interoperability Port - TK workaround available
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
PySimpleGUI/PySimpleGUI#6900 · 1 comentario ·
-
Done - Install Dev Build (see docs for how) enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
PySimpleGUI/PySimpleGUI#3251 · 12 comentarios ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 74/100
PySimpleGUI/PySimpleGUI#6906 · 1 comentario · 1 reacción ·
-
Bug Done - Install Dev Build (see docs for how) Port - TK
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
PySimpleGUI/PySimpleGUI#6902 · 1 comentario ·
Todos los issues de PySimpleGUI/PySimpleGUI
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
anthropics/skills#1811 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
speaches-ai/speaches#678 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
datalayer/mcp-compose#42 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
conda-forge/spacy-feedstock#177 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
UKGovernmentBEIS/inspect_evals#2523 ·