ampl / amplpy

Python API for AMPL

Home Page:https://amplpy.ampl.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing invalid license error messages

4er4er4er opened this issue · comments

When there is an invalid license file, an attempt to create an AMPL object fails with this message:

C:\Users\Robert\Desktop\Solvers>python
Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from amplpy import AMPL
>>> ampl = AMPL()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\4er\AppData\Local\Programs\Python\Python37\lib\site-packages\amplpy\ampl.py", line 85, in __init__
    self._impl = amplpython.AMPL()
SystemError: License not valid.
Message:38 error_ampl_lic
License file ampl.lic:


>>>

But when an attempt is made to start AMPL from the command line, with the same invalid license file, a lot of valuable diagnostic information is provided (which often enables the licensing problem to be fixed immediately):

sw: ampl
License file ampl.lic:
Current directory = "C:\Users\Robert\Desktop\Solvers".
Today = 20210616; found license file "ampl.lic":
# Temporary AMPL, CONOPT, CPLEX, GUROBI, KNITRO, MINOS, SNOPT & XPRESS
# single-machine server license expiring 20150331
# licensed to Bob Fourer <4er@ampl.com> (4erYoga13):
52fe61ca 667d214f 71ba9395 a173b131 f1e6e1e3 8d2aa539 a7fea7d8 b02a620b
86889bee 51b537b8 7144b644 f742a4c0 f283acf5 077a2866 81c992d7 a0d3baea
72b5ff57 f67537e6 02469700 565b2321 5571de8f a75dc3c3 34afc630 45384437
028bedb5 bf3f8636 8610e1c6 c2e27f4c f59716c4 6f9c62ab 15c3a66f c7a8c20b
836eea28 67c4e8fd 61aa739e 470754cb d17475e8 ba6f1257 006a5424 5735b1fe
92bcf4b1 4830dcc3 066ae545 06606fbc e27f7b41 9fc01384 f5ea76c5 e0

Computed 1-5-1-f00746e
4erYoga900
A4-34-D9-40-77-DA
A6-34-D9-40-77-D9
00-FF-26-55-CF-E5
A4-34-D9-40-77-D9
A4-34-D9-40-77-DD
FA15-9720

No ampl license for this machine.
AMPL Version 20210505 (MS VC++ 10.0, 64-bit)

sw:

Note that License file ampl.lic: is the last line of the amplpy error message, but is only the first line of the message from command-line AMPL. Can amplpy instead display all of the license error message that would appear at the command line?

Version 0.7.1 has just been released and it now includes the complete license error message in license exceptions.