Page 1 of 1

Can't start on Linux, TypeError: must be string, not unicode

Posted: Wed May 23, 2012 6:26 pm
by lifning
edit: My solution: http://ks.renai.us/viewtopic.php?f=45&t ... 29#p122529

Here's what running it as normal looks like:

Code: Select all

[lifning@agatha Katawa Shoujo-linux-x86]$ ./Katawa\ Shoujo.sh 
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/bootstrap.py", line 260, in bootstrap
    renpy.main.main()
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/main.py", line 173, in main
    game.script = renpy.script.load_script()
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/script.py", line 480, in load_script
    rv = Script()
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/script.py", line 160, in __init__
    self.load_appropriate_file(".rpyc", ".rpy", dir, fn, initcode)
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/script.py", line 373, in load_appropriate_file
    if self.load_file(dir, fn + compiled, initcode):
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/script.py", line 340, in load_file
    self.update_bytecode()
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/script.py", line 429, in update_bytecode
    code = renpy.python.py_compile_exec_bytecode(i.source, filename=i.location[0], lineno=i.location[1])
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/python.py", line 254, in py_compile_exec_bytecode
    code = py_compile(source, 'exec', **kwargs)
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/python.py", line 251, in py_compile
    return cg.getCode()
  File "py4renpy-6.10.1/linux-x86/lib/python2.5/compiler/pycodegen.py", line 245, in getCode
  File "py4renpy-6.10.1/linux-x86/lib/python2.5/compiler/pyassem.py", line 370, in getCode
  File "py4renpy-6.10.1/linux-x86/lib/python2.5/compiler/pyassem.py", line 475, in convertArgs
  File "py4renpy-6.10.1/linux-x86/lib/python2.5/compiler/pyassem.py", line 511, in _convert_LOAD_CONST
  File "py4renpy-6.10.1/linux-x86/lib/python2.5/compiler/pycodegen.py", line 245, in getCode
  File "py4renpy-6.10.1/linux-x86/lib/python2.5/compiler/pyassem.py", line 374, in getCode
  File "py4renpy-6.10.1/linux-x86/lib/python2.5/compiler/pyassem.py", line 603, in newCodeObject
TypeError: code() argument 9 must be string, not unicode

While compiling python block starting at line 7 of common/00atl.rpy.
Here's what running it with the system Python 2.7 (with Ren'Py et al installed as well) looks like:

Code: Select all

[lifning@agatha Katawa Shoujo-linux-x86]$ python2.7 Katawa\ Shoujo.py 
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/bootstrap.py", line 260, in bootstrap
    renpy.main.main()
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/main.py", line 173, in main
    game.script = renpy.script.load_script()
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/script.py", line 480, in load_script
    rv = Script()
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/script.py", line 160, in __init__
    self.load_appropriate_file(".rpyc", ".rpy", dir, fn, initcode)
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/script.py", line 373, in load_appropriate_file
    if self.load_file(dir, fn + compiled, initcode):
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/script.py", line 340, in load_file
    self.update_bytecode()
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/script.py", line 429, in update_bytecode
    code = renpy.python.py_compile_exec_bytecode(i.source, filename=i.location[0], lineno=i.location[1])
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/python.py", line 254, in py_compile_exec_bytecode
    code = py_compile(source, 'exec', **kwargs)
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/python.py", line 251, in py_compile
    return cg.getCode()
  File "/usr/lib/python2.7/compiler/pycodegen.py", line 248, in getCode
    return self.graph.getCode()
  File "/usr/lib/python2.7/compiler/pyassem.py", line 311, in getCode
    self.convertArgs()
  File "/usr/lib/python2.7/compiler/pyassem.py", line 416, in convertArgs
    self.insts[i] = opname, conv(self, oparg)
  File "/usr/lib/python2.7/compiler/pyassem.py", line 452, in _convert_LOAD_CONST
    arg = arg.getCode()
  File "/usr/lib/python2.7/compiler/pycodegen.py", line 248, in getCode
    return self.graph.getCode()
  File "/usr/lib/python2.7/compiler/pyassem.py", line 315, in getCode
    return self.newCodeObject()
  File "/usr/lib/python2.7/compiler/pyassem.py", line 544, in newCodeObject
    tuple(self.cellvars))
TypeError: must be string, not unicode

While compiling python block starting at line 7 of common/00atl.rpy.
And here's what running it with the latest version of py4renpy (6.11.2) replacing the bundled version looks like:

Code: Select all

[lifning@agatha Katawa Shoujo-linux-x86]$ ./Katawa\ Shoujo.sh 
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/bootstrap.py", line 260, in bootstrap
    renpy.main.main()
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/main.py", line 173, in main
    game.script = renpy.script.load_script()
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/script.py", line 480, in load_script
    rv = Script()
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/script.py", line 160, in __init__
    self.load_appropriate_file(".rpyc", ".rpy", dir, fn, initcode)
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/script.py", line 373, in load_appropriate_file
    if self.load_file(dir, fn + compiled, initcode):
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/script.py", line 340, in load_file
    self.update_bytecode()
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/script.py", line 429, in update_bytecode
    code = renpy.python.py_compile_exec_bytecode(i.source, filename=i.location[0], lineno=i.location[1])
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/python.py", line 254, in py_compile_exec_bytecode
    code = py_compile(source, 'exec', **kwargs)
  File "/home/lifning/Desktop/Katawa Shoujo-linux-x86/renpy/python.py", line 251, in py_compile
    return cg.getCode()
  File "py4renpy-6.11.2/linux-x86/lib/python2.6/compiler/pycodegen.py", line 247, in getCode
  File "py4renpy-6.11.2/linux-x86/lib/python2.6/compiler/pyassem.py", line 370, in getCode
  File "py4renpy-6.11.2/linux-x86/lib/python2.6/compiler/pyassem.py", line 475, in convertArgs
  File "py4renpy-6.11.2/linux-x86/lib/python2.6/compiler/pyassem.py", line 511, in _convert_LOAD_CONST
  File "py4renpy-6.11.2/linux-x86/lib/python2.6/compiler/pycodegen.py", line 247, in getCode
  File "py4renpy-6.11.2/linux-x86/lib/python2.6/compiler/pyassem.py", line 374, in getCode
  File "py4renpy-6.11.2/linux-x86/lib/python2.6/compiler/pyassem.py", line 603, in newCodeObject
TypeError: code() argument 9 must be string, not unicode

While compiling python block starting at line 7 of common/00atl.rpy.
Those last two were just stabs in the dark at trying to fix it. Has anyone else encountered or worked around this issue?

edit: Arch Linux 64, by the way.

Re: Can't start on Linux, TypeError: must be string, not uni

Posted: Thu May 24, 2012 6:59 am
by antiandrew
Do you have 32bit libs?

Re: Can't start on Linux, TypeError: must be string, not uni

Posted: Thu May 24, 2012 4:31 pm
by demonix
Unfortunately you answered your own problem as the game will only run on 32-bit versions of linux

Re: Can't start on Linux, TypeError: must be string, not uni

Posted: Sun Jun 03, 2012 3:25 pm
by lifning
antiandrew wrote:Do you have 32bit libs?
Yes I do.
demonix wrote:Unfortunately you answered your own problem as the game will only run on 32-bit versions of linux
Interesting... Being based on Python suggested to me that it should be architecture-independent. If I manage to hack together a solution to make this so in the future, I guess I'll post my methods here. I've already had a start on it since posting this thread, but ran into another seemingly separate issue regarding unpickling code from the compiled ".rpyc" files included with RenPy. I presume it has to do with differences in RenPy versions.

Re: Can't start on Linux, TypeError: must be string, not uni

Posted: Sun Jun 03, 2012 5:49 pm
by demonix
I'm not sure if you'll be allowed to do that since what you're doing could be classed as altering the game which is a breach of the games license (plus it could also be counted as porting it to another platform which also isn't allowed on here so posting your solution here might not be allowed either).

Re: Can't start on Linux, TypeError: must be string, not uni

Posted: Wed Jun 06, 2012 4:46 pm
by Ichigo-Roku
I think he can do it if he keeps the work for him, with no redistribution of it.

Re: Can't start on Linux, TypeError: must be string, not uni

Posted: Sat Jun 16, 2012 3:28 am
by HTL2001
Actually it looks like he's fixing bugs in py4renpy (which is MIT licensed) that are preventing it from properly loading the game. Where he talks about unpickling is just how python loads the files, it has nothing to do with editing actual game files. If this works with 32 bit machines there's no reason it shouldn't work on 64 bit if the bugs are corrected, it shouldn't require any changes to game files at all.

Also, I imagine other games using renpy that fail to launch on 64 bit could benefit from this as well.

Re: Can't start on Linux, TypeError: must be string, not uni

Posted: Tue Jun 26, 2012 5:38 pm
by Yukito-San
Hi, i was using both Ubuntu 11.10 64 bit and Arch Linux 64 bit around february and march. They was working very well at the time. Now, i have updated Ubuntu on 12.04 LTS 64 bit and Arch Linux 64 bit, they don't work anymore on both Linux OS. Does i need a lib32 package for renpy or python ? Seem i have the same problem.

Thx for more info for how to fix this. ^_^

Re: Can't start on Linux, TypeError: must be string, not uni

Posted: Tue Jun 26, 2012 7:10 pm
by dwarduk
I'm on 12.04 64-bit for Ubuntu, and KS works perfectly so long as I launch it with the shell script; I get the title error if I try to launch the python script directly.

Re: Can't start on Linux, TypeError: must be string, not uni

Posted: Mon Sep 03, 2012 8:09 pm
by lifning
I got it working, so posting what I found out as per sacred "Wisdom of the Ancients" duty.

Turns out the problem was the engine getting confused about where the proper RenPy files were. It was trying to load incompatible modules from the latest version (I have it installed system-wide as well, as I mentioned), instead of the included py4renpy distribution. A recent change to aur/renpy gave me the hint that I should try to unset the environment variable "RENPY_BASE" before running KS, after which it launched as it should.

For my own convenience, I just put "unset RENPY_BASE" on line 2 of the launcher script, a fix trivial and obvious enough (once you know the cause) that I hope I won't upset anyone by posting it. If you'd prefer not to modify even the launcher script, that same command can go in your ~/.bashrc (or the equivalent for your favorite shell), or you can just type it manually before running the launcher, or you can get rid of whatever put it in your environment in the first place...