-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Python3 compatibility breaks brew file init
command
#69
Comments
Thank you for the feedback. First of all, could you please upgrade brerw-file? It seems older version.
About builtin module, future package is needed to be installed for python2, |
Hey, I'm sorry I totally forgot about this thread. It's been pretty hectic with the end of the semester and all. I am, in fact, on the latest version of brew-file.
|
Could you please check followings?
And test
|
I use % which python
/usr/local/var/pyenv/shims/python
% pyenv which python
/usr/local/var/pyenv/versions/3.5.2/bin/python
% type python
python is /usr/local/var/pyenv/shims/python
% python --version
Python 3.5.2
% echo $PYTHONPATH
Here's the test of % python
Python 3.5.2 (default, Nov 28 2016, 12:44:30)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> input('test: ')
test: aaa |
brew-file uses shebang of Here is the minimum script of
Could you please try to run this script? |
if you still have a problem, re-open the issue. |
The problem had stopped occurring, but it just happened again today. I ran the script you gave (and changed the print statement on the last line to be correct for python 3) and got the following:
I also added a statement to the script to test which version of python is running ( |
Now I understand the problem. fixed input problem at python3 · rcmdnk/homebrew-file@cbbbc70 This fix should solve it, in v4.1.8. |
Hi, I'm still having the same problem despite using the latest version (v4.1.14 20/Mar/2017). Running Traceback (most recent call last):
File "/usr/local/bin/brew-file", line 3251, in <module>
main()
File "/usr/local/bin/brew-file", line 3248, in main
b.execute()
File "/usr/local/bin/brew-file", line 2875, in execute
self.initialize()
File "/usr/local/bin/brew-file", line 1834, in initialize
"((n) for local Brewfile).")
File "/usr/local/bin/brew-file", line 883, in ask_yn
yn = my_input(question + " [y/n]: ").lower()
File "/usr/local/bin/brew-file", line 60, in my_input
return _input(word)
UnboundLocalError: local variable '_input' referenced before assignment I sort of got a workaround working it by changing the shebang, to force using |
yes, sry, I put another bug... I'v fixed and v4.1.15 must be fine... |
Thanks for the quick reply! It works now. |
When executing the
brew file init
command (using Python 3.5.2), the following error is thrown:I believe that I fixed the issue on my installation by modifying the
my_input
function, and then making a similar revision to themy_decode
function because it looked like it might cause similar errors in the future. These are my modifications:Now,
type(my_decode(word))
returns<class 'str'>
in Python 3 and<class 'future.types.newstr.newstr'>
in Python 2. According to python-future,Additionally, the
input()
method is now equivalent toraw_input()
in Python 2, while remaining unchanged in Python 3. I didn't see any Python 2input()
calls that needed to be changed toeval(input())
, but I could have missed one.I don't know if you had your own reasons for not importing from the
builtins
module that come with thefuture
module, and granted I did no testing other than looking to see if thebrew file init
command worked, but it seems to be working so far.The text was updated successfully, but these errors were encountered: