Skip to content

Setting pythonpath for all environments #1180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions python/prodV4/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ def determine_user_pkg_paths():
func_worker_dir = str(Path(__file__).absolute().parent)
env = os.environ

if is_azure_environment():
user_pkg_paths = determine_user_pkg_paths()
joined_pkg_paths = os.pathsep.join(user_pkg_paths)
# Setting up python path for all environments to prioritize
# third-party user packages over worker packages in PYTHONPATH
user_pkg_paths = determine_user_pkg_paths()
joined_pkg_paths = os.pathsep.join(user_pkg_paths)
env['PYTHONPATH'] = f'{joined_pkg_paths}:{func_worker_dir}'

# On cloud, we prioritize third-party user packages
# over worker packages in PYTHONPATH
env['PYTHONPATH'] = f'{joined_pkg_paths}:{func_worker_dir}'
if is_azure_environment():
os.execve(sys.executable,
[sys.executable, '-m', 'azure_functions_worker']
+ sys.argv[1:],
Expand Down