cflavio / yorg

Yorg (Yorg's an Open Racing Game) is a free open source racing game developed by Ya2 using Panda3D for Windows, OSX and Linux.
Other
177 stars 33 forks source link

Yorg on a Raspberry Pi 3B #27

Closed tcdude closed 5 years ago

tcdude commented 5 years ago

I was playing around with a Raspberry Pi 3+ and Panda3D and was wondering whether Yorg would run, unfortunately it already fails when I run the scons command.

I get the following output:

scons: Reading SConscript files ...
TypeError: sequence item 0: expected str instance, bytes found:
  File "/home/pi/yorg/SConstruct", line 2:
    from yyagl.build.build import extensions, files, img_tgt_names, \
  File "/home/pi/yorg/yyagl/build/build.py", line 100:
    branch = branch2ver[__branch()] if __branch() in branch2ver else __branch()
  File "/home/pi/yorg/yyagl/build/build.py", line 21:
    return exec_cmd('git symbolic-ref HEAD').split('/')[-1].strip()
  File "/home/pi/yorg/yyagl/build/build.py", line 17:
    return '\n'.join(ret)

and by naively trying to avoid that error through the means making a string out of the bytes, it fails at this point:

scons: Reading SConscript files ...
  File "/home/pi/yorg/yyagl/build/windows.py", line 78

    SectionEnd'''

               ^

SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 1508-1509: truncated \UXXXXXXXX escape

I'm running Panda3D 1.10.2 on Raspbian Stretch with Python 3.5.3 and I tried both master and stable branches w/o change in outcome of the scons command.

cflavio commented 5 years ago

Hi! Actually, I've never tried to build it on a Raspberry: I apologize for the troubles you're experiencing.

First of all, since you're using Python 3, please use the master branch. I've ported the project to Python 3 only in the master branch: I'll merge master into testing and stable as soon as it becomes stabler. :)

Unfortunately, I can't replicate your issue on my system(s). So, if it doesn't annoy you (otherwise, ignore the following part), I would ask you for more information. Please, could you apply the following patch to the submodule yyagl?

index b719134..520fee8 100644
--- a/build/build.py
+++ b/build/build.py
@@ -9,6 +9,13 @@ def exec_cmd(cmd):

 def __branch():
+    elements = [
+        exec_cmd('git symbolic-ref HEAD'),
+        exec_cmd('git symbolic-ref HEAD').split('/'),
+        exec_cmd('git symbolic-ref HEAD').split('/')[-1],
+        exec_cmd('git symbolic-ref HEAD').split('/')[-1].strip()]
+    for elm in elements:
+        print(elm, type(elm))
     return exec_cmd('git symbolic-ref HEAD').split('/')[-1].strip()

The error happens in the code that retrieves the current branch's name: I presume that you've a different behaviour on your system. The patch prints some information about the relevant code, here's what happens on my system:

user@host:~/path/to/yorg$ scons lang=1
...
('refs/heads/master\n\n', <type 'str'>)
(['refs', 'heads', 'master\n\n'], <type 'list'>)
('master\n\n', <type 'str'>)
('master', <type 'str'>)
('refs/heads/master\n\n', <type 'str'>)
(['refs', 'heads', 'master\n\n'], <type 'list'>)
('master\n\n', <type 'str'>)
('master', <type 'str'>)

(I've submitted scons lang=1 since it's faster than other build targets). What do you get on your system?

Thank you very much! ^_^

tcdude commented 5 years ago

Here is the output on the Raspberry:

scons: Reading SConscript files ...
b'refs/heads/master\n'
b'' <class 'str'>
["b'refs", 'heads', "master\\n'\nb''"] <class 'list'>
master\n'
b'' <class 'str'>
master\n'
b'' <class 'str'>
b'refs/heads/master\n'
b'' <class 'str'>
["b'refs", 'heads', "master\\n'\nb''"] <class 'list'>
master\n'
b'' <class 'str'>
master\n'
b'' <class 'str'>

hope it helps, but don't fret over it. FWIW I was just trying to see how much Panda the RPi could handle and thought of trying Yorg to see how well it works.

cflavio commented 5 years ago

Hi! Actually, the behaviour is really different, and I can't replicate the issue. :( I am going to try it on a RPi as soon as I can get it. Thanks!

tcdude commented 5 years ago

Just a wild guess, but it could maybe have something to do with the Python version that comes with Raspbian. Have you tried this with a Python 3.5 installation on a PC before?

cflavio commented 5 years ago

Hi! Actually, I thought that SCons used virtualenv's Python (which is Py3 on my setup), but it is not true: SCons uses system's Python instead (with default settings). So, actually I was building it with Py2. I should've fixed that, let me know if there are other issues. Thank you so much for reporting that! ^_^