Running AMPL using Python script

62 views
Skip to first unread message

mebarki...@gmail.com

unread,
Apr 19, 2018, 12:52:26 PM4/19/18
to AMPL Modeling Language
Dear all,

I having a problem in putting the AMPL folder in the system search path.

I would like to run AMPL using python script, but unfortunately, I haven’t found a useful tip to do.

Would you please send me any useful links that might explain how to do it right.


AMPL Google Group

unread,
Apr 19, 2018, 6:18:39 PM4/19/18
to Ampl Modeling Language
You can use the following workaround, which should work on any operating system:

import os
os.environ['PATH'] += os.pathsep + 'full path to the folder containing the AMPL binary'
...
ampl = AMPL()

Note that you may need to use raw strings (e.g., r'C:\ampl\ampl.mswin64') or escape the slashes (e.g., 'C:\\ampl\\ampl.mswin64') if the path includes backslashes.

Best regards,
Filipe

--
Filipe Brandão
am...@googlegroups.com
{#HS:564796347-5645#}

Screen%2BShot%2B2018-04-19%2Bat%2BPM%2B6.07.48.png


--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.



Khalil Mebarkia

unread,
Apr 20, 2018, 7:33:55 AM4/20/18
to AMPL Modeling Language
It works now

Thank you

Reply all
Reply to author
Forward
0 new messages