Skip to content
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

AttributeError: '__NSCFString' object has no attribute 'get' #323

Closed
LawrenceIRL opened this issue Nov 29, 2016 · 20 comments
Closed

AttributeError: '__NSCFString' object has no attribute 'get' #323

LawrenceIRL opened this issue Nov 29, 2016 · 20 comments

Comments

@LawrenceIRL
Copy link

LawrenceIRL commented Nov 29, 2016

Hello, I just set this up but I am having an issue with any recipe that I try. Is there a particular version of Python that I should have installed?

According to Console/System Logs, this is the error:

(FULL AUTOPKG TRACEBACK) 
  File "/usr/local/bin/autopkg", line 2400, in <module>

    sys.exit(main(sys.argv))
  File "/usr/local/bin/autopkg", line 2394, in main

    exit(subcommands[verb]['function'](argv))
  File "/usr/local/bin/autopkg", line 1854, in run_recipes

    recipe_paths.extend(recipe_list.get('recipes', []))
AttributeError: '__NSCFString' object has no attribute 'get'

This issue occurs on both Mac OS X 10.11 and macOS 10.12.

Thanks!

@gregneagle
Copy link
Contributor

What version of autopkg?

You may also want to post on autopkg-discuss.

As for JSS Importer issues, https://github.com/sheagcraig/JSSImporter/issues is probably a better place to look/report -- the JSSImporter is not part of the core AutoPkg project and the core AutoPkg maintainers don't use Casper/JAMFPro.

@LawrenceIRL
Copy link
Author

LawrenceIRL commented Nov 29, 2016

That's a good call, will do. I have edited the original post to exclude that.

Additionally, I should have posted in: https://github.com/lindegroup/autopkgr

Just noticed.

However, this would be the latest release of AutoPkg (1.0.0) but I will post over there.

@gregneagle
Copy link
Contributor

The AutoPkgr folk are going to ask you to test via the command line.

autopkg run SomeRecipe.pkg
autopkg run --recipe-list ~/Library/Application\ Support/AutoPkgr/recipe_list.txt

etc.

@gregneagle
Copy link
Contributor

@homebysix
Copy link
Member

For what it's worth, I'm getting the same error when running a test recipe list:

$ autopkg run -v --recipe-list ~/Library/Application\ Support/AutoPkgr/test_recipe_list.txt 
Traceback (most recent call last):
  File "/usr/local/bin/autopkg", line 2400, in <module>
    sys.exit(main(sys.argv))
  File "/usr/local/bin/autopkg", line 2394, in main
    exit(subcommands[verb]['function'](argv))
  File "/usr/local/bin/autopkg", line 1854, in run_recipes
    recipe_paths.extend(recipe_list.get('recipes', []))
AttributeError: '__NSCFString' object has no attribute 'get'

$ autopkg version
1.0.0

@gregneagle
Copy link
Contributor

And I get no such error.

@LawrenceIRL
Copy link
Author

LawrenceIRL commented Nov 29, 2016

That @homebysix did! Apologies about the cross-post issue. I had originally meant to put it over on AutoPkgr.

MACHINENAME:~ USERNAME$ /usr/bin/python /usr/local/bin/autopkg run --recipe-list ~/Library/Application\ Support/AutoPkgr/recipe_list.txt --report-plist /tmp/autopkg-report.xml
Traceback (most recent call last):
  File "/usr/local/bin/autopkg", line 2400, in <module>
    sys.exit(main(sys.argv))
  File "/usr/local/bin/autopkg", line 2394, in main
    exit(subcommands[verb]['function'](argv))
  File "/usr/local/bin/autopkg", line 1854, in run_recipes
    recipe_paths.extend(recipe_list.get('recipes', []))
AttributeError: '__NSCFString' object has no attribute 'get'

@gregneagle
Copy link
Contributor

gregneagle commented Nov 29, 2016

Perhaps share a recipe_list.txt file generated by AutoPkgr? (because 1.0 now supports recipe_lists in plist format)

@gregneagle
Copy link
Contributor

@homebysix
Copy link
Member

$ echo "com.github.autopkg.munki.munkitools2" > /tmp/recipe_list.txt

$ autopkg run -v --recipe-list /tmp/recipe_list.txt 
Traceback (most recent call last):
  File "/usr/local/bin/autopkg", line 2400, in <module>
    sys.exit(main(sys.argv))
  File "/usr/local/bin/autopkg", line 2394, in main
    exit(subcommands[verb]['function'](argv))
  File "/usr/local/bin/autopkg", line 1854, in run_recipes
    recipe_paths.extend(recipe_list.get('recipes', []))
AttributeError: '__NSCFString' object has no attribute 'get'

I'm not going to say AutoPkgr isn't involved, but it looks that way at first glance.

@homebysix
Copy link
Member

Looks like it works fine if given a plist:

$ cat /tmp/recipe_list.plist 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>recipes</key>
    <array>
        <string>com.github.autopkg.munki.munkitools2</string>
    </array>
</dict>
</plist>

$ autopkg run -v --recipe-list /tmp/recipe_list.plist 
Processing com.github.autopkg.munki.munkitools2...
--- etc. ---

@gregneagle
Copy link
Contributor

gregneagle commented Nov 29, 2016

I'm sure it's the support for plist recipe lists. Too bad there wasn't a lengthy testing period where people might have tested this and found and reported issues before official release. :-( But again, 1.0 works fine here with plain text recipe lists that look like this:

AdobeAIR.munki
AdobeFlashPlayer.munki
AdobeReader.munki
AdobeReaderDC.munki
AdobeShockwavePlayer.munki
Atom.munki
#(etc)

@LawrenceIRL
Copy link
Author

LawrenceIRL commented Nov 29, 2016

I can confirm what @homebysix is saying. With the recipe list in a plist format, it seems to like that.

@timsutton
Copy link
Member

Can you please share 1) your recipe list that's causing the issue, and 2) the output of a run of autopkg with increased verbosity (autopkg run -vvv)?

@LawrenceIRL
Copy link
Author

The output above is verbose.

@timsutton This happens on any recipe list.

But here a sample that it happens with:
com.github.autopkg.download.firefox-rc-en_US

@gregneagle
Copy link
Contributor

As it turns out, it doesn't happen on any recipe list. It happens only with version 1.0.0 on plain-text recipe lists containing a single item.

Using recipe lists that contain a single item is not common for non-AutoPkgr users, as it's more work and more difficult than just running the single recipe directly. A fix has been pushed to GitHub. 1a912bb

@LawrenceIRL
Copy link
Author

LawrenceIRL commented Nov 29, 2016

@gregneagle Ah, okay, that's good to know. I meant any single one that I have tried. Example: this happens when I try to run a single recipe directly. If i was say, following this guide: https://github.com/homebysix/auto-update-magic

@homebysix
Copy link
Member

@TheVakman When this fix is included in an official release, AutoPkgr users will be able to update with one click. Until then, I'd recommend "checking" more than one recipe in AutoPkgr for now.

@LawrenceIRL
Copy link
Author

@homebysix Sounds good!

@timsutton
Copy link
Member

AutoPkg 1.0.1 just released with this fix - AutoPkgr should now show this as an available update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants