mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-04 11:14:21 +08:00
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.
This commit is contained in:
parent
7d312f2f24
commit
a314c4943b
@ -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)
|
||||
lionbridge_import(args.source)
|
||||
|
Loading…
x
Reference in New Issue
Block a user