From 12f2490586cacf7e89679b5d2d1ddf073b2b68c3 Mon Sep 17 00:00:00 2001 From: Osama Mohammed Al-zabidi <57198110+omamkaz@users.noreply.github.com> Date: Wed, 4 Dec 2024 00:14:48 +0300 Subject: [PATCH] Update project_dependencies.py (#4459) # `Fixed` when I get no markers key in the version_value variable. ```bash Traceback (most recent call last): File "/opt/hostedtoolcache/Python/3.12.5/x64/bin/flet", line 8, in sys.exit(main()) ^^^^^^ File "/opt/hostedtoolcache/Python/3.12.5/x64/lib/python3.12/site-packages/flet/cli.py", line 12, in main flet_cli.cli.main() File "/opt/hostedtoolcache/Python/3.12.5/x64/lib/python3.12/site-packages/flet_cli/cli.py", line 89, in main args.handler(args) File "/opt/hostedtoolcache/Python/3.12.5/x64/lib/python3.12/site-packages/flet_cli/commands/build.py", line 557, in handle self.package_python_app() File "/opt/hostedtoolcache/Python/3.12.5/x64/lib/python3.12/site-packages/flet_cli/commands/build.py", line 1303, in package_python_app toml_dependencies = get_poetry_dependencies( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/hostedtoolcache/Python/3.12.5/x64/lib/python3.12/site-packages/flet_cli/utils/project_dependencies.py", line 41, in get_poetry_dependencies format_dependency_version(dependency, version) File "/opt/hostedtoolcache/Python/3.12.5/x64/lib/python3.12/site-packages/flet_cli/utils/project_dependencies.py", line 21, in format_dependency_version if version_value["markers"]: ~~~~~~~~~~~~~^^^^^^^^^^^ KeyError: 'markers' ``` --- .../flet-cli/src/flet_cli/utils/project_dependencies.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/python/packages/flet-cli/src/flet_cli/utils/project_dependencies.py b/sdk/python/packages/flet-cli/src/flet_cli/utils/project_dependencies.py index 756a68356..218705576 100644 --- a/sdk/python/packages/flet-cli/src/flet_cli/utils/project_dependencies.py +++ b/sdk/python/packages/flet-cli/src/flet_cli/utils/project_dependencies.py @@ -18,8 +18,9 @@ def format_dependency_version(dependency: str, version_value: Any): suffix = "" if isinstance(version_value, dict): version = version_value["version"] - if version_value["markers"]: - suffix = f";{version_value['markers']}" + markers = version_value.get("markers") + if markers is not None: + suffix = f";{markers}" else: version = version_value