Closed leliamesteban closed 6 years ago
Thanks - I have tests based in python3 (was that what you were using?). How can I repro?
On Sat, Jun 10, 2017 at 7:17 PM, leliamesteban notifications@github.com wrote:
Installing on ArchLinux with
sudo pip install shutit # defaults to pip3
and then running
shutit skeleton
results in the following error: NameError: name 'raw_input' is not defined
Full traceback:
Traceback (most recent call last): File "./shutit.py", line 60, in
main() File "./shutit.py", line 53, in main shutit.setup_shutit_obj() File "/home/liam/shutit/shutit_class.py", line 3907, in setup_shutit_obj self.parse_args() File "/home/liam/shutit/shutit_class.py", line 3559, in parse_args vagrant_docker=args.vagrant_docker)) File "/home/liam/shutit/shutit_class.py", line 3119, in process_args self.handle_skeleton(args) File "/home/liam/shutit/shutit_class.py", line 3218, in handle_skeleton module_directory = shutit_util.util_raw_input(prompt='# Input a name for this module.\n# Default: ' + default_dir + '\n', default=default_dir) File "/home/liam/shutit/shutit_util.py", line 250, in util_raw_input resp = raw_input(prompt).strip() NameError: name 'raw_input' is not defined I then installed with pip2.7 and it's working now, but I was unable to see this anywhere other than your setup.py file. Shouldn't it be documented somewhere more visible, eg. the Readme or your website? I almost gave up experimenting with this tool, maybe other people would too.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ianmiell/shutit/issues/299, or mute the thread https://github.com/notifications/unsubscribe-auth/AGrczYz-ih8RQgrejJGL_WUB2QNEs75Jks5sCt2xgaJpZM4N2LyV .
-- My book on Docker in Practice: Get 39% off with the code 39miell http://manning.com/miell/?a_aid=zwischenzugs&a_bid=e0d48f62
I get the same traceback on Python 3.6.
Successfully installed MarkupSafe-1.0 future-0.16.0 jinja2-2.9.6 pexpect-4.2.1 ptyprocess-0.5.1 shutit-1.0.2 six-1.10.0 texttable-0.9.0
(env) Madiss-MacBook-Pro:shipper konstruktor$ shutit skeleton
Traceback (most recent call last):
File "/Users/konstruktor/Documents/development/shipper/env/bin/shutit", line 11, in <module>
sys.exit(main())
File "/Users/konstruktor/Documents/development/shipper/env/lib/python3.6/site-packages/shutit.py", line 53, in main
shutit.setup_shutit_obj()
File "/Users/konstruktor/Documents/development/shipper/env/lib/python3.6/site-packages/shutit_class.py", line 3907, in setup_shutit_obj
self.parse_args()
File "/Users/konstruktor/Documents/development/shipper/env/lib/python3.6/site-packages/shutit_class.py", line 3559, in parse_args
vagrant_docker=args.vagrant_docker))
File "/Users/konstruktor/Documents/development/shipper/env/lib/python3.6/site-packages/shutit_class.py", line 3119, in process_args
self.handle_skeleton(args)
File "/Users/konstruktor/Documents/development/shipper/env/lib/python3.6/site-packages/shutit_class.py", line 3218, in handle_skeleton
module_directory = shutit_util.util_raw_input(prompt='# Input a name for this module.\n# Default: ' + default_dir + '\n', default=default_dir)
File "/Users/konstruktor/Documents/development/shipper/env/lib/python3.6/site-packages/shutit_util.py", line 250, in util_raw_input
resp = raw_input(prompt).strip()
NameError: name 'raw_input' is not defined
Python3 changed input
to behave like raw_input
and ditched the latter name. You could make 2 and 3 happy by using input
everywhere and making sure it's defined the same:
try:
input = raw_input
except NameError:
pass
Thanks - will look at implementing this in the morning.
On Mon, Jun 12, 2017 at 10:12 PM, davy wybiral notifications@github.com wrote:
Python3 changed input to behave like raw_input and ditched the latter name. You could make 2 and 3 happy by using input everywhere and making sure it's defined the same:
try: input = raw_input except NameError: pass
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ianmiell/shutit/issues/299#issuecomment-307930643, or mute the thread https://github.com/notifications/unsubscribe-auth/AGrczYgurKorRt4EfFhDjGorHl3Br5Vuks5sDamzgaJpZM4N2LyV .
-- My book on Docker in Practice: Get 39% off with the code 39miell http://manning.com/miell/?a_aid=zwischenzugs&a_bid=e0d48f62
This should be fixed now as of 1.0.3
Unfortunately, this doesn't work in Python 3:
ashish@server1:~/foo$ shutit skeleton
Traceback (most recent call last):
File "/home/ashish/.local/bin/shutit", line 11, in <module>
sys.exit(main())
File "/home/ashish/.local/lib/python3.5/site-packages/shutit.py", line 53, in main
shutit.setup_shutit_obj()
File "/home/ashish/.local/lib/python3.5/site-packages/shutit_class.py", line 3905, in setup_shutit_obj
self.parse_args()
File "/home/ashish/.local/lib/python3.5/site-packages/shutit_class.py", line 3557, in parse_args
vagrant_docker=args.vagrant_docker))
File "/home/ashish/.local/lib/python3.5/site-packages/shutit_class.py", line 3119, in process_args
self.handle_skeleton(args)
File "/home/ashish/.local/lib/python3.5/site-packages/shutit_class.py", line 3218, in handle_skeleton
module_directory = shutit_util.util_raw_input(prompt='# Input a name for this module.\n# Default: ' + default_dir + '\n', default=default_dir)
File "/home/ashish/.local/lib/python3.5/site-packages/shutit_util.py", line 243, in util_raw_input
return input(prompt).strip() or default
UnboundLocalError: local variable 'input' referenced before assignment
You should use from builtins import input
instead to maintain compatibility.
Thanks for letting me know. I'll try and fix today.
On Wed, Jul 26, 2017 at 10:25 AM, Ashish Kulkarni notifications@github.com wrote:
Unfortunately, this doesn't work in Python 3:
ashish@server1:~/foo$ shutit skeleton Traceback (most recent call last): File "/home/ashish/.local/bin/shutit", line 11, in
sys.exit(main()) File "/home/ashish/.local/lib/python3.5/site-packages/shutit.py", line 53, in main shutit.setup_shutit_obj() File "/home/ashish/.local/lib/python3.5/site-packages/shutit_class.py", line 3905, in setup_shutit_obj self.parse_args() File "/home/ashish/.local/lib/python3.5/site-packages/shutit_class.py", line 3557, in parse_args vagrant_docker=args.vagrant_docker)) File "/home/ashish/.local/lib/python3.5/site-packages/shutit_class.py", line 3119, in process_args self.handle_skeleton(args) File "/home/ashish/.local/lib/python3.5/site-packages/shutit_class.py", line 3218, in handle_skeleton module_directory = shutit_util.util_raw_input(prompt='# Input a name for this module.\n# Default: ' + default_dir + '\n', default=default_dir) File "/home/ashish/.local/lib/python3.5/site-packages/shutit_util.py", line 243, in util_raw_input return input(prompt).strip() or default UnboundLocalError: local variable 'input' referenced before assignment You should use from builtins import input instead to maintain compatibility http://python-future.org/compatible_idioms.html#raw-input.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/ianmiell/shutit/issues/299#issuecomment-317999933, or mute the thread https://github.com/notifications/unsubscribe-auth/AGrczXEoQKCm2zVEtGGadTrjDLvZt1Ydks5sRwYdgaJpZM4N2LyV .
-- My book on Docker in Practice: Get 39% off with the code 39miell http://manning.com/miell/?a_aid=zwischenzugs&a_bid=e0d48f62
I've pushed a new version - can you determine whether that's resolved @ashkulz ?
Sorry for the late reply, it's not yet fixed -- submitted a PR.
I'm confused, shouldn't this be resolved with #306 , I'm still getting
Traceback (most recent call last):
File "/home/damjan/.pyenv/versions/shutit/bin/shutit", line 11, in <module>
load_entry_point('shutit==1.0.44', 'console_scripts', 'shutit')()
File "/home/damjan/.pyenv/versions/3.6.0/envs/shutit/lib/python3.6/site-packages/shutit.py", line 67, in main
shutit.setup_shutit_obj()
File "/home/damjan/.pyenv/versions/3.6.0/envs/shutit/lib/python3.6/site-packages/shutit_class.py", line 3957, in setup_shutit_obj
self.do_build()
File "/home/damjan/.pyenv/versions/3.6.0/envs/shutit/lib/python3.6/site-packages/shutit_class.py", line 4196, in do_build
self.build_module(module)
File "/home/damjan/.pyenv/versions/3.6.0/envs/shutit/lib/python3.6/site-packages/shutit_class.py", line 4138, in build_module
if not module.build(self):
File "/home/damjan/.pyenv/versions/3.6.0/envs/shutit/lib/python3.6/site-packages/shutit_module.py", line 59, in wrapper
ret = func(self, shutit)
File "/home/damjan/GitRepos/shutit-k8s-the-hard-way/shutit_k8s_the_hard_way.py", line 92, in build
shutit.login(command='vagrant ssh ' + machine,prompt_prefix=machine,note='Log into machine: ' + machine)
File "/home/damjan/.pyenv/versions/3.6.0/envs/shutit/lib/python3.6/site-packages/shutit_class.py", line 1903, in login
loglevel=loglevel))
File "/home/damjan/.pyenv/versions/3.6.0/envs/shutit/lib/python3.6/site-packages/shutit_pexpect.py", line 327, in login
self.shutit.handle_note(sendspec.note,command=command + '\n\n[as user: "' + user + '"]',training_input=send)
File "/home/damjan/.pyenv/versions/3.6.0/envs/shutit/lib/python3.6/site-packages/shutit_class.py", line 791, in handle_note
while shutit_util.util_raw_input(prompt=shutit_util.colourise('32','Enter the command to continue (or "s" to skip typing it in): ')) not in (training_input,'s'):
File "/home/damjan/.pyenv/versions/3.6.0/envs/shutit/lib/python3.6/site-packages/shutit_util.py", line 247, in util_raw_input
return input(prompt).strip() or default
UnboundLocalError: local variable 'input' referenced before assignment
with Python 3.6.0 and shutit (1.0.44)
On the command line, what does this give you?
from builtins import input
sys.version_info[0] >= 3
On Sat, Dec 16, 2017 at 11:56 PM, Damjan Dvoršek notifications@github.com wrote:
I'm confused, shouldn't this be resolved with #306 https://github.com/ianmiell/shutit/pull/306 , I'm still getting
Traceback (most recent call last): File "/home/damjan/.pyenv/versions/shutit/bin/shutit", line 11, in
load_entry_point('shutit==1.0.44', 'console_scripts', 'shutit')() File "/home/damjan/.pyenv/versions/3.6.0/envs/shutit/lib/python3.6/site-packages/shutit.py", line 67, in main shutit.setup_shutit_obj() File "/home/damjan/.pyenv/versions/3.6.0/envs/shutit/lib/python3.6/site-packages/shutit_class.py", line 3957, in setup_shutit_obj self.do_build() File "/home/damjan/.pyenv/versions/3.6.0/envs/shutit/lib/python3.6/site-packages/shutit_class.py", line 4196, in do_build self.build_module(module) File "/home/damjan/.pyenv/versions/3.6.0/envs/shutit/lib/python3.6/site-packages/shutit_class.py", line 4138, in build_module if not module.build(self): File "/home/damjan/.pyenv/versions/3.6.0/envs/shutit/lib/python3.6/site-packages/shutit_module.py", line 59, in wrapper ret = func(self, shutit) File "/home/damjan/GitRepos/shutit-k8s-the-hard-way/shutit_k8s_the_hard_way.py", line 92, in build shutit.login(command='vagrant ssh ' + machine,prompt_prefix=machine,note='Log into machine: ' + machine) File "/home/damjan/.pyenv/versions/3.6.0/envs/shutit/lib/python3.6/site-packages/shutit_class.py", line 1903, in login loglevel=loglevel)) File "/home/damjan/.pyenv/versions/3.6.0/envs/shutit/lib/python3.6/site-packages/shutit_pexpect.py", line 327, in login self.shutit.handle_note(sendspec.note,command=command + '\n\n[as user: "' + user + '"]',training_input=send) File "/home/damjan/.pyenv/versions/3.6.0/envs/shutit/lib/python3.6/site-packages/shutit_class.py", line 791, in handle_note while shutit_util.util_raw_input(prompt=shutit_util.colourise('32','Enter the command to continue (or "s" to skip typing it in): ')) not in (training_input,'s'): File "/home/damjan/.pyenv/versions/3.6.0/envs/shutit/lib/python3.6/site-packages/shutit_util.py", line 247, in util_raw_input return input(prompt).strip() or default UnboundLocalError: local variable 'input' referenced before assignment with Python 3.6.0 and shutit (1.0.44)
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/ianmiell/shutit/issues/299#issuecomment-352220556, or mute the thread https://github.com/notifications/unsubscribe-auth/AGrczR9Ye8UWNovv6ZGMYnwF0K7lNik6ks5tBFi7gaJpZM4N2LyV .
-- My book on Docker in Practice: Get 39% off with the code 39miell2 https://www.manning.com/books/docker-in-practice-second-edition?a_aid=zwischenzugs&a_bid=550032fc
You probably meant
>>> import sys
>>> (sys.version_info[0] >= 3)
True
gives Tue which is expected, that is why I was confused, because this
if not PY3:
try:
input = raw_input
except NameError:
pass
works as it should
I also checked if there is the line
from builtins import input
inside shutit_util.py
and it is not there.
It should be there:
https://github.com/ianmiell/shutit/blob/master/shutit_util.py#L48-L49
so am puzzled.
I'll need to test on a python3 vagrant test box I have to check it all works as expected.
On Sun, Dec 17, 2017 at 10:18 PM, Damjan Dvoršek notifications@github.com wrote:
You probably meant
import sys (sys.version_info[0] >= 3) True
gives Tue which is expected, that is why I was confused, because this
if not PY3: try: input = raw_input except NameError: pass
works as it should
I also checked if there is the line
from builtins import input
inside shutit_util.py and it is not there.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/ianmiell/shutit/issues/299#issuecomment-352290351, or mute the thread https://github.com/notifications/unsubscribe-auth/AGrczeQ7JoIrKNJ9XmIhBO2i-6dITdIwks5tBZM-gaJpZM4N2LyV .
-- My book on Docker in Practice: Get 39% off with the code 39miell2 https://www.manning.com/books/docker-in-practice-second-edition?a_aid=zwischenzugs&a_bid=550032fc
The line is there I missed it because I looked among imports.
ShutIt version: 1.0.47 Python 3.5.2
I got the error :
File "/home/mrloyal/Temp/shutit/lib/python3.5/site-packages/shutit_util.py", line 247, in util_raw_input
return input(prompt).strip() or default
UnboundLocalError: local variable 'input' referenced before assignment
Line 237 of the same file, I commented out input = raw_input
and now it works, no more error.
Installing on ArchLinux with
and then running
results in the following error:
NameError: name 'raw_input' is not defined
Full traceback:
I then installed with
pip2.7
and it's working now, but I was unable to see this anywhere other than yoursetup.py
file. Shouldn't it be documented somewhere more visible, eg. the Readme or your website? I almost gave up experimenting with this tool, maybe other people would too.