Skip to content

Commit

Permalink
update in msx
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariosmsk committed Apr 16, 2024
1 parent 37434cd commit e675c46
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions epyt/epanet.py
Original file line number Diff line number Diff line change
Expand Up @@ -11163,7 +11163,7 @@ def loadMSXFile(self, msxname):
d.loadMSXFile('net2-cl2.msx')
"""
self.realmsx = msxname
self.msx = epanetmsxapi()
self.msx = epanetmsxapi(ignore_msxfile=True)
self.MSXPythonSetup(msxname)

def unloadMSX(self):
Expand Down Expand Up @@ -15654,9 +15654,8 @@ def ENwriteline(self, line):
class epanetmsxapi:
"""example msx = epanetmsxapi()"""

def __init__(self, msxfile='', ignore_msxfile=False):
if not ignore_msxfile:

def __init__(self, msxfile='', loadlib=True, ignore_msxfile=False):
if loadlib:
ops = platform.system().lower()
if ops in ["windows"]:
self.MSXLibEPANET = resource_filename("epyt", os.path.join("libraries", "win", "epanetmsx.dll"))
Expand All @@ -15671,6 +15670,7 @@ def __init__(self, msxfile='', ignore_msxfile=False):
self.msx_error = self.msx_lib.MSXgeterror
self.msx_error.argtypes = [c_int, c_char_p, c_int]

if not ignore_msxfile:
if not os.path.exists(msxfile):
raise FileNotFoundError(f"File not found: {msxfile}")

Expand All @@ -15690,7 +15690,7 @@ def MSXopen(self, msxfile):
if not os.path.exists(msxfile):
raise FileNotFoundError(f"File not found: {msxfile}")

msxfile = c_char_p(msxfile.encode('utf-8'))
msxfile = bytes(msxfile, 'utf-8')
err = self.msx_lib.MSXopen(msxfile)
if err != 0:
self.MSXerror(err)
Expand Down

0 comments on commit e675c46

Please sign in to comment.