Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when using -i #5

Open
breitburg opened this issue Feb 22, 2025 · 3 comments
Open

Crash when using -i #5

breitburg opened this issue Feb 22, 2025 · 3 comments

Comments

@breitburg
Copy link

When I run gptree -i the app crashes.

% gptree -i
Enter the root directory of the project [.]: lib
Combining files in lib into gptree_output.txt...
Found .gitignore in: /Users/breitburg/Developer/pollyanna
Traceback (most recent call last):
  File "/Users/breitburg/.local/bin/gptree", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/Users/breitburg/.local/pipx/venvs/gptree-cli/lib/python3.13/site-packages/cli_tool_gptree/main.py", line 510, in main
    combined_content, selected_files = combine_files_with_structure(
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        path,
        ^^^^^
    ...<3 lines>...
        safe_mode=config["safeMode"]
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/breitburg/.local/pipx/venvs/gptree-cli/lib/python3.13/site-packages/cli_tool_gptree/main.py", line 203, in combine_files_with_structure
    selected_files = interactive_file_selector(file_list)
  File "/Users/breitburg/.local/pipx/venvs/gptree-cli/lib/python3.13/site-packages/cli_tool_gptree/main.py", line 176, in interactive_file_selector
    curses.wrapper(draw_menu)
    ~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.2/Frameworks/Python.framework/Versions/3.13/lib/python3.13/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/Users/breitburg/.local/pipx/venvs/gptree-cli/lib/python3.13/site-packages/cli_tool_gptree/main.py", line 137, in draw_menu
    stdscr.addstr(idx + 2, 0, f"{prefix} {file[:70]}")
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_curses.error: addwstr() returned ERR
@travisvn
Copy link
Owner

@breitburg Can you provide more diagnostic information?

Does gptree work when not using interactive mode? Does it work in other directories? What OS are you using? etc

@breitburg
Copy link
Author

breitburg commented Feb 23, 2025

@travisvn

Running on macOS 15.3.1 (24D70). I think I found the root cause: The command works normally without -i, but crashes when using the -i flag if the terminal window is too small. Then this crash occurs consistently, across all directories.

Image Image

@travisvn
Copy link
Owner

@breitburg Interesting 🤔

One more thing I think you might want to try — if you've installed it using pip or pipx, try installing it via Homebrew. The binary loads itself completely differently. I'd give it a higher probability of working

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

No branches or pull requests

2 participants