Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGhostkeeper <rubend@tutanota.com>2020-04-15 17:18:02 +0300
committerGhostkeeper <rubend@tutanota.com>2020-04-15 19:08:04 +0300
commita314c4943b6b4b35c0c6e8b151f83875eb59c026 (patch)
treeb5e60cabc5a3ebedf24ccc34d01188185b4cabe6 /scripts
parent7d312f2f2480a7124164e0795b2820618bec760d (diff)
Fix import script if Uranium is not on your PYTHONPATH
It was doing an os.path.exists on the relative path which has no context of where we're looking from. So make it absolute first and then check for the existence of the file. Also take the correct parent folder then and improve debug output.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lionbridge_import.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/scripts/lionbridge_import.py b/scripts/lionbridge_import.py
index 0c2c132216..83f53403ea 100644
--- a/scripts/lionbridge_import.py
+++ b/scripts/lionbridge_import.py
@@ -55,11 +55,13 @@ def destination_uranium() -> str:
import UM
except ImportError:
relative_path = os.path.join(__file__, "..", "..", "..", "Uranium", "resources", "i18n", "uranium.pot")
- print(os.path.abspath(relative_path))
- if os.path.exists(relative_path):
- return os.path.abspath(relative_path)
+ absolute_path = os.path.abspath(relative_path)
+ if os.path.exists(absolute_path):
+ absolute_path = os.path.abspath(os.path.join(absolute_path, ".."))
+ print("Uranium is at:", absolute_path)
+ return absolute_path
else:
- raise Exception("Can't find Uranium. Please put UM on the PYTHONPATH or put the Uranium folder next to the Cura folder.")
+ raise Exception("Can't find Uranium. Please put UM on the PYTHONPATH or put the Uranium folder next to the Cura folder. Looked for: " + absolute_path)
return os.path.abspath(os.path.join(UM.__file__, "..", "..", "resources", "i18n"))
## Merges translations from the source file into the destination file if they
@@ -177,4 +179,4 @@ if __name__ == "__main__":
argparser = argparse.ArgumentParser(description = "Import translation files from Lionbridge.")
argparser.add_argument("source")
args = argparser.parse_args()
- lionbridge_import(args.source) \ No newline at end of file
+ lionbridge_import(args.source)