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

Fixes ptpython/ptipython config and history (#278) #279

Merged
merged 4 commits into from
Mar 22, 2025

Conversation

notdaniel
Copy link
Contributor

@notdaniel notdaniel commented Mar 16, 2025

This fixes the ptpython/ptipython configuration issue from #278. It will now iterate through a list of all possible config directory locations in order of priority and use the first one it finds, if one exists.

Additionally, very similar logic is now applied to the history filename location to address these 2 bugs:

  1. On linux, ptpython no longer keeps the history file inside the config directory, but in a different place entirely. Fixing the config directory issue does not make history work properly.

  2. Previously, a history_filename was being passed to embed whether it existed or not. If it doesn't exist, ptpython will try to create it and write to it, but unfortunately it only checks whether the file exists, and not whether its parent directories do. Giving it a history_filename that doesn't exist is fine as long as its parent directory does, but if not, it throws an exception.

It now looks for the history directory in the correct places, and if it cannot find one, it passes history_filename=None to embed.

Copy link
Owner

@sloria sloria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR!

just a small refactor suggestion. otherwise good to go after that

@notdaniel notdaniel force-pushed the fix-ptpython-config branch from 260e780 to 59d4043 Compare March 22, 2025 15:20
@sloria sloria enabled auto-merge (squash) March 22, 2025 15:47
@sloria
Copy link
Owner

sloria commented Mar 22, 2025

thank you!

@sloria sloria merged commit bc69e95 into sloria:main Mar 22, 2025
8 checks passed
@notdaniel notdaniel deleted the fix-ptpython-config branch March 23, 2025 04:42
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

Successfully merging this pull request may close these issues.

2 participants