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

[core/camera]Update camera_android.py; fixes camera for Python 3 #6051

Merged
merged 1 commit into from Nov 16, 2018

Conversation

gbm001
Copy link
Contributor

@gbm001 gbm001 commented Nov 16, 2018

In Python 3, the buffer needs to an explicit bytestring rather than a string; hence changing:
buf = '\x00' * self._bufsize
to
buf = b'\x00' * self._bufsize

Fixes various issues:
in Kivy #5939
and in associated garden project ZbarCam kivy-garden/garden.zbarcam#13

In Python 3, the buffer needs to an explicit bytestring rather than a string; hence changing:
buf = '\x00' * self._bufsize
to
buf = b'\x00' * self._bufsize

Fixes various issues:
in Kivy kivy#5939
and in associated garden project ZbarCam kivy-garden/garden.zbarcam#13
@welcome
Copy link

welcome bot commented Nov 16, 2018

Thanks for opening your first pull request here! 💖 Please check out our contributing guidelines.

@tito
Copy link
Member

tito commented Nov 16, 2018

Is this still working with Python 2? I mean did you tried?

@gbm001
Copy link
Contributor Author

gbm001 commented Nov 16, 2018

I haven't because I haven't got a Python 2 environment set up to test it (I am very new to Kivy). However, it shouldn't make any difference in Python 2.6 as b'xxxxx' is completely identical to 'xxxxx' in Python 2. It will cause a SyntaxError in Python 2.5 as the syntax was introduced in 2.6, but I believe Kivy only supports 2.7+?

(strictly speaking the only differences are that if you have used from __future__ import unicode_literals it will reverse that, and that if you do 2to3 on your source code it will leave it as a bytestring rather than converting it to a Unicode string).

@tito tito merged commit 083473b into kivy:master Nov 16, 2018
@welcome
Copy link

welcome bot commented Nov 16, 2018

Congrats on merging your first pull request! 🎉🎉🎉

@tito
Copy link
Member

tito commented Nov 16, 2018

@gbm001 Thanks you!

@matham matham changed the title Update camera_android.py; fixes camera for Python 3 [core/camera]Update camera_android.py; fixes camera for Python 3 May 23, 2019
@einav888
Copy link

einav888 commented Feb 5, 2020

I checked the camera_android.py file and it already was: buf = b'\x00' * self._bufsize
I'm trying to run this -> https://kivy.org/doc/stable/examples/gen__camera__main__py.html on Kivy Launcher. It runs perfectly on my computer, but crashes automatically on Kivy Launcher.
Do you have any idea what the reason could be?

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

Successfully merging this pull request may close these issues.

None yet

3 participants