Skip to content
New issue

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

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

Already on GitHub? # to your account

Problem with )set output characters default #8

Open
fahasch opened this issue Jan 21, 2024 · 4 comments
Open

Problem with )set output characters default #8

fahasch opened this issue Jan 21, 2024 · 4 comments

Comments

@fahasch
Copy link

fahasch commented Jan 21, 2024

There is a problem when using the setting )set output characters default in the configuration file .fricas.input. Using this setting, the line -------Categories------- gets replaced by ───── Categories ───── when executing )what categories.
Because of this, the search string in the command startswith that parses )what categories should be adjusted as well.

@hemmecke
Copy link
Contributor

Yes, that seems to be true. So there seem to be people out there using )set output character default. Thank you for reporting.
I guess you know how to fix that yourself.

@fahasch
Copy link
Author

fahasch commented Jan 21, 2024

I did a stupid fix such that it only works with )set output character default. For me it works but nothing that I could submit as pull request.

@hemmecke
Copy link
Contributor

hemmecke commented Jan 21, 2024

There are probably various ways to fix it. Since determining the list of identifiers is done in a completely separate process from the one that is used for the actual session, one can simply override whatever was written in .fricas.input as in the following replacement for the respective code in fricaskernel.py.

    pid0 = Popen(['fricas', '-nosman
                 '-eval', ')set output character plain',
                 '-eval', ')what operations',
                 '-eval', ')what categories',
                 '-eval', ')what domains',
                 '-eval', ')what packages',
                 '-eval', ')quit'],stdout=PIPE)

Another way would be to ignore fricas.input for this process by emptying the FRICAS_INITFILE environment variable for the above call. (I do not yet know how that would be done in python and it is also questionable whether that is the best way, since a person might have additional identifiers produced/loaded in his .fricas.input.
A third way is to check for "-" and for "─".
I am not yet sure what the best way would be so that jfricas also works with future versions of FriCAS where )set output character might have been removed.

@fahasch
Copy link
Author

fahasch commented Jan 21, 2024

If it is a fringe case (it seems like that) then another alternative would be to simply to state that having )set output character default is not allowed. However, I have to say (from experience) it is quite hard to debug where the problem originates from. Personally, I would favour to replace xxx.startswith('----------------') (it appear twice) with

xxx.replace('─','-').startswith('----------------')

One could add a comment that explains why the replace is needed.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants