From 9619e00974a69a95ec1bccf2d497a453d4b544bc Mon Sep 17 00:00:00 2001 From: Alexey Prey Mulyukin Date: Tue, 27 Nov 2018 19:34:58 +0300 Subject: [PATCH] Fix issue #199. Change logic to build a result file name in xmile-py transpiler. --- pysd/py_backend/xmile/xmile2py.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pysd/py_backend/xmile/xmile2py.py b/pysd/py_backend/xmile/xmile2py.py index 7cd5df52..06cf8ba8 100644 --- a/pysd/py_backend/xmile/xmile2py.py +++ b/pysd/py_backend/xmile/xmile2py.py @@ -11,6 +11,7 @@ from lxml import etree from ...py_backend import builder, utils +import os.path import numpy as np def translate_xmile(xmile_file): @@ -327,7 +328,10 @@ def parse_lookup_xml_node(node): 'arguments': '', }) - outfile_name = xmile_file.replace('.xmile', '.py') + file_name, file_extension = os.path.splitext(xmile_file) + base_dir = os.path.dirname(xmile_file) + + outfile_name = base_dir + os.path.sep + file_name + '.py' builder.build(elements=model_elements, subscript_dict={},