ynput / ayon-launcher

AYON desktop application launcher
Apache License 2.0
31 stars 13 forks source link

Remove first argument when running script #110

Closed iLLiCiTiT closed 4 months ago

iLLiCiTiT commented 5 months ago

Changelog Description

Content of sys.argv does not contain start.py script or ayon-launcher executable.

Additional information

Reopened https://github.com/ynput/ayon-launcher/pull/94 . Changes in ayon-core were made and this change should be safe to do now.

This change might be done globaly in future PRs, now I'm too scared to do so.

Testing notes:

  1. Setup python script like below:
    
    import argparse

def main():

Create ArgumentParser object

parser = argparse.ArgumentParser(description="Script description")

# Add arguments
parser.add_argument(
    "--something", type=str, required=True
)

# Parse the arguments
args = parser.parse_args()
print(args.something)

if name == "main": main()

2. Run commandline to execute python script in AYON context:

.\tools\manage.ps1 run C:\Users\tokejepsen\Desktop\temp.py --something else


Error this PR fixes:

usage: start.py [-h] --something SOMETHING start.py: error: unrecognized arguments: C:\Users\tokejepsen\Desktop\temp.py