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

Python3 error with pexpect #221

Closed
ghost opened this issue Aug 6, 2015 · 8 comments
Closed

Python3 error with pexpect #221

ghost opened this issue Aug 6, 2015 · 8 comments

Comments

@ghost
Copy link

ghost commented Aug 6, 2015

On Ubuntu 14.04, after running:

buildozer -v android debug

I got:

Traceback (most recent call last):
  File "/usr/local/bin/buildozer", line 9, in <module>
    load_entry_point('buildozer==0.30dev', 'console_scripts', 'buildozer')()
  File "/usr/local/lib/python3.4/dist-packages/buildozer-0.30dev-py3.4.egg/buildozer/scripts/client.py", line 13, in main
    Buildozer().run_command(sys.argv[1:])
  File "/usr/local/lib/python3.4/dist-packages/buildozer-0.30dev-py3.4.egg/buildozer/__init__.py", line 981, in run_command
    self.target.run_commands(args)
  File "/usr/local/lib/python3.4/dist-packages/buildozer-0.30dev-py3.4.egg/buildozer/target.py", line 85, in run_commands
    func(args)
  File "/usr/local/lib/python3.4/dist-packages/buildozer-0.30dev-py3.4.egg/buildozer/target.py", line 95, in cmd_debug
    self.buildozer.prepare_for_build()
  File "/usr/local/lib/python3.4/dist-packages/buildozer-0.30dev-py3.4.egg/buildozer/__init__.py", line 162, in prepare_for_build
    self.target.install_platform()
  File "/usr/local/lib/python3.4/dist-packages/buildozer-0.30dev-py3.4.egg/buildozer/targets/android.py", line 419, in install_platform
    self._install_android_packages()
  File "/usr/local/lib/python3.4/dist-packages/buildozer-0.30dev-py3.4.egg/buildozer/targets/android.py", line 380, in _install_android_packages
    self._android_update_sdk(self._build_package_string('build-tools', ver))
  File "/usr/local/lib/python3.4/dist-packages/buildozer-0.30dev-py3.4.egg/buildozer/targets/android.py", line 314, in _android_update_sdk
    index = child.expect([EOF, u'[y/n]: '])
  File "/usr/local/lib/python3.4/dist-packages/pexpect-3.3-py3.4.egg/pexpect/__init__.py", line 1451, in expect
  File "/usr/local/lib/python3.4/dist-packages/pexpect-3.3-py3.4.egg/pexpect/__init__.py", line 1466, in expect_list
  File "/usr/local/lib/python3.4/dist-packages/pexpect-3.3-py3.4.egg/pexpect/__init__.py", line 1535, in expect_loop
  File "/usr/local/lib/python3.4/dist-packages/pexpect-3.3-py3.4.egg/pexpect/__init__.py", line 985, in read_nonblocking
  File "/usr/local/lib/python3.4/dist-packages/pexpect-3.3-py3.4.egg/pexpect/__init__.py", line 904, in _log
  File "/usr/lib/python3.4/codecs.py", line 369, in write
    self.stream.write(data)
TypeError: must be str, not bytes

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@inclement inclement added the py3 label Aug 6, 2015
@ghost
Copy link
Author

ghost commented Aug 6, 2015

In buildozer/targets/android.py, line 314, since child.expect() takes a string, replacing
index = child.expect([EOF, u'[y/n]: ']) by index = child.expect(EOF) seems
to solve the error. I got the .apk file. We just have to see if the output file works on android.

@ndapost
Copy link

ndapost commented Aug 18, 2015

@he2lo
It didn't help

@tito
Copy link
Member

tito commented Oct 4, 2015

Wrong, except doesn't take a string, but a pattern, and pattern can be multiple component as the doc explained:
http://pexpect.readthedocs.org/en/stable/api/pexpect.html?highlight=expect#pexpect.spawn.expect

This has already been reported as an issue with Python 3.4 + pexpect in pexpect/pexpect#159

Try using pexpect 4.0 ?

@ptmono
Copy link

ptmono commented Oct 6, 2015

I have same issue. Using pexpect 4.0 is not solve the problem.

@wannaphong
Copy link

Now , pexpect support Python 3 ?

pohmelie added a commit to pohmelie/buildozer that referenced this issue Mar 13, 2016
This cause, that stdout is text file, but codecs.StreamWriter encodes string to bytes.
inclement added a commit that referenced this issue Mar 14, 2016
add python3 compatibility to verbose output for android build (#221)
@shadrech
Copy link

shadrech commented Apr 6, 2016

I'm also faced with this exact issue. I've seen people complaining of this issue since 2014...any solution yet?

@bcm0
Copy link

bcm0 commented Aug 30, 2016

Updating to buildozer-0.32 pexpect-4.2.1 and ptyprocess-0.5.1 solved the issue for me.
I used Python 3.5.2.

@AndreMiras
Copy link
Member

I think this was solved a long time ago. Feel free to open a fresh new bug report if not

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

No branches or pull requests

8 participants