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

modernize pager code #445

Closed
olaurino opened this issue Apr 20, 2018 · 6 comments · Fixed by #583
Closed

modernize pager code #445

olaurino opened this issue Apr 20, 2018 · 6 comments · Fixed by #583

Comments

@olaurino
Copy link
Member

While testing the 4.10.0 conda binaries I ran into an issue with the utility function that displays information from sherpa in a pager:

def _send_to_pager(all, filename=None, clobber=False):

There is a lot of hard-coded logic that can be replaced with something more robust. I quickly gave a look around and found this:
https://stackoverflow.com/a/37585086

@olaurino
Copy link
Member Author

Let me add that I don't think the issue is likely to happen at all in regular deployments... I am testing in barebone docker containers that do not have more installed and do not have PAGER set. Regular users usually have both. I worked around this in my tests by setting PAGER to less, which is present in the docker image I am using.

@DougBurke
Copy link
Contributor

I was just having a discussion with a local user today who said that when they used a function like sherpa.astro.ui.show_model in a Jupyter notebook then the output when to the terminal running the server, and not the notebook. I suggested passing in a StringIO object via the outfile parameter and then displaying the contents, but it's not ideal.

@kglotfelty
Copy link
Collaborator

Adding to Doug's notebook example, a CIAO helpdesk user [ref 21322] is running sherpa via spyder and ran into the same problem that show_*() routines page the results into the terminal where the GUI was launched (or maybe into some system log if the GUI was launched from an Applications window)

@olaurino
Copy link
Member Author

should we make this a higher priority?

@DougBurke
Copy link
Contributor

I am okay with increasing the priority, but I haven't looked at your road map to see how this fits in. Note that there is a chunk of work we could do to make Sherpa work "better" within notebooks (e.g. #345 #347 but I haven't done an exhaustive check to see if there are more), but not for Sherpa 4.11 unless we get external contributors working on it.

I don't think it should a big job code-wise, but maybe more work on the policy/API-design side (i.e. what we want to happen and how to control things).

@DougBurke
Copy link
Contributor

I've just tried out the pydoc.pager suggestion @olaurino pointed to and it seems to work in both a notebook (where there was no paging) and from IPython. So I think it's a worthwhile change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants