Closed digitalbydesign closed 5 years ago
Python3 won't like the print syntax as it's the 2 command vs function so that's expected (on my list for the new year).
For 2, what python version are you running and what version of argparse is in use (argparse.__version__
)? We were talking about this in Slack a week or two ago (#installapplications on the MacAdmins.org slack if you're not there yet) and at some point argparse stopped being happy with setting both nargs to unlimited and defining the metavars tuple... for now, the workaround is to just remove the metavars tuple, argparse will still map things correctly.
You’ll have to excuse me as I’m not a python coder, merely a sysadmin trying to create bootstrap packages for Airwatch deployment. Can you briefly explain how to remove the metavars tuple? I’ll jump on my computer shortly and check the argparse version.
Sent with GitHawk
Sure - open up generatejson.py in a text editor and comment out lines 110, 111, and 112 of the script (add a # before them). Re-run and check your bootstrap.json output for validity, it has been working without issue for at least two of us so far but you'll want to spot check your own setup to be confident.
That seems to have gotten me past the initial errors I was getting. Now I'm just not understanding the syntax of the parameters to pass through to generatejson.py. The guide from VMware had the following syntax:
generatejson.py --rootdir /path/to/directory_with_pkgs --base-url https://url_of_s3_bucket
I'm guessing the syntax has changed since their documentation but now I'm not sure how to accomplish the same task.
Yes, that sounds like their documentation refers to the old version of the script which is definitely going to cause that issue! The current script was re-written some time ago to be more flexible – if you open the readme file in the repo and go to the bottom, you’ll see the updated documentation / syntax for the new script. The long and short is that you pass the individual items to the script rather than having it guess from the folder structure.
From: digitalbydesign notifications@github.com Reply-To: erikng/installapplications reply@reply.github.com Date: Thursday, December 27, 2018 at 8:19 PM To: erikng/installapplications installapplications@noreply.github.com Cc: Rick Heil rheil@mergeworld.com, Comment comment@noreply.github.com Subject: Re: [erikng/installapplications] Invalid Syntax (#45)
That seems to have gotten me past the initial errors I was getting. Now I'm just not understanding the syntax of the parameters to pass through to generatejson.py. The guide from VMware had the following syntax:
generatejson.py --rootdir /path/to/directory_with_pkgs --base-url https://url_of_s3_bucket
I'm guessing the syntax has changed since their documentation but now I'm not sure how to accomplish the same task.
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/erikng/installapplications/issues/45#issuecomment-450267208, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AIi2vAX0Kkoya2y3_7jMVTrAAioJM8IZks5u9XGUgaJpZM4ZjNid.
I've addressed the python2 error by reverting some changes. Closing this.
I'm trying to use this to create a bootstrap package and am running into a road block. Can anyone point me in the right direction? Using macOS 10.14.2 and tried in both python2 and python3.
Error in python3: File "/Users/troyhite/Desktop/macOSBootstrap/PackageBuilds/installapplications-master/generatejson.py", line 60 print "Error: %s while extracting BOM for %s" % (err, filename) ^ SyntaxError: invalid syntax
Error in python2: Traceback (most recent call last): File "/Users/troyhite/Desktop/macOSBootstrap/PackageBuilds/installapplications-master/generatejson.py", line 256, in
main()
File "/Users/troyhite/Desktop/macOSBootstrap/PackageBuilds/installapplications-master/generatejson.py", line 115, in main
Scripts default to rootscript and stage defaults to userland')
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1306, in add_argument
raise ValueError("length of metavar tuple does not match nargs")
ValueError: length of metavar tuple does not match nargs