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

Small bug in PHC interface #29179

Closed
kcrisman opened this issue Feb 11, 2020 · 3 comments
Closed

Small bug in PHC interface #29179

kcrisman opened this issue Feb 11, 2020 · 3 comments

Comments

@kcrisman
Copy link
Member

While trying to fix things on https://wiki.sagemath.org/interact/algebra I noticed the following problem if one doesn't have PHC installed:

sage: print(os.system('which phc') + '  PHC needs to be installed and in your path')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-f9a470112020> in <module>()
----> 1 print(os.system('which phc') + '  PHC needs to be installed and in your path')

TypeError: unsupported operand type(s) for +: 'int' and 'str'
sage: os.system('which phc') 
256

This is from https://github.com/sagemath/sage-prod/blob/develop/src/sage/interfaces/phc.py#L939

        if e:
            from sage.misc.sage_ostools import have_program
            if not have_program('phc'):
                print(os.system('which phc') + '  PHC needs to be installed and in your path')
                raise RuntimeError
            # todo -- why? etc.
            with open(log_filename) as f:
                msg = f.read()
            raise RuntimeError(msg + "\nError running phc.")

But it is never tested because all the optional tests are, well, optional! Anyway, the fix should be pretty easy, make it a string - presumably something left over from the py3 switch.

But we should also test this, somehow. How do you test for when a package is not installed?

Component: interfaces

Issue created by migration from https://trac.sagemath.org/ticket/29179

@kcrisman kcrisman added this to the sage-9.1 milestone Feb 11, 2020
@fchapoton
Copy link
Contributor

comment:1

see #29163 ?

@kcrisman
Copy link
Member Author

comment:2

see #29163 ?

Hilarious! I probably saw that email and said, "I don't know anything about PHC" and ignored it ... please accept my apologies, and thanks for fixing it!

@kcrisman
Copy link
Member Author

comment:4

Though my comment about testing still stands ... is there some ticket open about testing for the non-presence of a package? This is a desideratum. I can open one if you don't know of one.

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

No branches or pull requests

2 participants