jssimporter / python-jss

python-jss is deprecated. Please see the wiki for alternatives.
GNU General Public License v3.0
102 stars 41 forks source link

make raw_input forward-compatible with py3 #103

Closed arubdesu closed 4 years ago

arubdesu commented 4 years ago

update files in the project that had used py2-only raw_input, test_jssprefs.py also makes reference but doesn't seem to call it directly. Doesn't exactly use prescribed fix, but got idea from a related stackoverflow, addresses #101

grahampugh commented 4 years ago

Hi @arubdesu thanks for this. What would be the easiest test for this? You're trying to make a JSS connection without a prefs file, right?

arubdesu commented 4 years ago

Correct, failure state reproduced:

mv ~/Library/Preferences/com.github.sheagcraig.python-jss.plist ~/Library/Preferences/com.github.sheagcraig.python-jss-totheside.plist
cd /Library/AutoPkg/JSSImporter
/Library/AutoPkg/Python3/Python.framework/Versions/Current/bin/python3
>>> import jss
>>> jss_prefs = jss.JSSPrefs()
It seems like you do not have a preferences file configured. Please answer the following questions to generate a plist at /Users/allister/Library/Preferences/com.github.sheagcraig.python-jss.plist for use with python-jss.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/AutoPkg/JSSImporter/jss/jss_prefs.py", line 132, in __init__
    self.configure()
  File "/Library/AutoPkg/JSSImporter/jss/jss_prefs.py", line 175, in configure
    prefs["jss_url"] = raw_input(
NameError: name 'raw_input' is not defined

whereas with the fix I'd instead see

It seems like you do not have a preferences file configured. Please answer the following questions to generate a plist at /Users/allister/Library/Preferences/com.github.sheagcraig.python-jss.plist for use with python-jss.
The complete URL to your JSS, with port (e.g. 'https://mycasperserver.org:8443')
URL: 
grahampugh commented 4 years ago

Thanks, sounds legit so merged :)