Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
cmu
New Contributor
cmu
Posts: 3
Registered: ‎10-09-2012
My Device: Playbook
Accepted Solution

Python - SyntaxError: Non-UTF-8 code starting with '\x9f'

[ Edited ]

Hi together,

 

I get the following error message when starting my Qt applications on my Playbook:

 

File "app/python/example02", line 1
SyntaxError: Non-UTF-8 code starting with '\x9f' in file app/python/example02 on line 2, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

I use the bbndk-2.1.0-beta1 and Qt 4.8.3 from http://qt-project.org/wiki/Building-Qt4-for-Blackberry. BlackBerry  Playbook version is 2.1.0.1032. Host PC is running Ojuba Linux (Fedora 16 clone with non-pae kernel), Python is version 2.7.3.

 

Best Regards

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Python - SyntaxError: Non-UTF-8 code starting with '\x9f'

So it seems to be telling you that your Python file has some non-UTF8-encoded data in it. What's around line 2 of the example02 file?

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
cmu
New Contributor
cmu
Posts: 3
Registered: ‎10-09-2012
My Device: Playbook

Re: Python - SyntaxError: Non-UTF-8 code starting with '\x9f'

Line 1 is:

ELF\00\00\00\00\00\00\00\00\00\00(\00\00\00\00<    \004\00\00\00t\00\00\00\004\00 \00\00(\00\00\00\00\00p\BC \00\00\BC \00\BC \00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\004\00\00\004\00\004\00\00\E0\00\00\00\E0\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\C8 \00\00\C8 \00\00\00\00\00\00\00\00\00\00\00\C8 \00\00\C8\00\C8\00p\00\00\90\00\00\00\00\00\00\00\00\00\00\00\D4 \00\00\D4\00\D4\00\F8\00\00\00\F8\00\00\00\00\00\00\00\00\00\00\00\00(\00\00(\00(\00\00\00\00\00\00\00\00\00\00\00\00\00/usr/lib/ldqnx.so.2\00\00\00\00\00\00\00\00\00\00QNX\00\00\00\00\00\00\00\006\00\00\00%\00\00\00#\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00 \00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00$\00\00\00\00\00\00\00

 

Line 2 is:

\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00

Line 3 is:

\00\00\00!\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00    \00\00\00\00\00\00\00\00\00\00\00\00\00\00 \00\00\00\00\00\00"\00\00\00\00\00\00 \00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00s\00\00X\00\00\00\00\00\00\00\00N\00\00\00\00\00\00\00\00\00\00\00 \00\00\00\C1\00\00\00\00\00\00\00\00\00\00\00 \00\00\00\D6\00\008\00\00\00\00\00\00\87\00\00\00h \00\00\00\00\00\00 \00\00\00\00p\00\00\00\00\00\00\00\00?\00\00\00\00\00\00\00\00\00\00\00"\00\00\00\CA\00\00\88\00\00\00\00\00\00\00\00:\00\00\94\00\00\00\00\00\00\00\00\00\00\A0\00\00\00\00\00\00\00\00/\00\004\00\00\00\00\00\00\00*\00\00\00\AC\00\00\00\00\00\00\00\00O\00\008\00\00\00\00\00\00\F1\FF#\00\00\C4 \00\00\00\00\00\00\F1\FF\EB\00\00\B8\00\00\00\00\00\00\00\00a\00\00\C4\00\00\00\00\00\00\00\00i\00\00X\00\00\00\00\00\00\F1\FF]\00\00X\00\00\00\00\00\00\F1\FFC\00\008\00\00\00\00\00\00\F1\FF\8D\00\00\00\D0\00\00\00\00\00\00\00\00\EB\00\00\00\DC\00\00\00\00\00\00\00\00d\00\00\00\E8\00\00\00\00\00\00\00\00\A2\00\00\00\F4\00\00\00\00\00\00\00\00^\00\00X\00\00\00\00\00\00\F1\FF\FB\00\00\00    \00\00\00\00\00\00\00\00\DC\00\00     \00\00\00\00\00\00\00\00*\00\00X\00\00\00\00\00\00\F1\FF    \00\00    \00\00\00\00\00\00\00\00\00\00<    \00\00\00\00\00\00

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Python - SyntaxError: Non-UTF-8 code starting with '\x9f'

Okay, so now the question becomes "What the heck are you doing?" :-)

That's not a Python file... it's a native binary in ELF format. Probably should be under app/native/example02 instead.

Why is Python even involved here? Are you attempting to bundle a ported version of the Python runtime with your app? Did you somehow use the "blackberry-pythonpackager" instead of "blackberry-nativepackager" to build the .bar file? Something's very strange here...

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
cmu
New Contributor
cmu
Posts: 3
Registered: ‎10-09-2012
My Device: Playbook

Re: Python - SyntaxError: Non-UTF-8 code starting with '\x9f'

Okay, yes, you got it :-), I used the blackberry-pythonpackager instead of the blackberry-nativepackager. I don't know how this happens. I thank you very much for your help :Balloon:

Please use plain text.