Adding "other" libraries to Ren'Py

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
nintendotoad
Regular
Posts: 42
Joined: Sat Mar 31, 2012 2:56 pm
Location: projectexist.net
Contact:

Adding "other" libraries to Ren'Py

#1 Post by nintendotoad »

So there've been times where I wanted Ren'Py to do something somewhat odd - at this particular moment, I'd like it to be able to run lua scripts.

lunatic-python-bugfix seems to allow me to do this. Ignoring the fact that I'd have to compile it for 3-4 platforms, how would I add the binaries to Ren'Py in the first place so that the "import lua" line works?

At the moment, I'm staring at two built *.so files. I tried throwing them into the "renpy/lib/darwin-x86_64/lib/python2.7" area (seeing that I'm on Mac OS X at the moment). I ended up with the following problem:

Code: Select all

ImportError: dlopen(/Applications/renpy/renpy.app/Contents/MacOS/../../../lib/darwin-x86_64/lib/python2.7/lua.so, 2): Symbol not found: _PyUnicodeUCS2_FromFormat
  Referenced from: /Applications/renpy/renpy.app/Contents/MacOS/../../../lib/darwin-x86_64/lib/python2.7/lua.so
  Expected in: flat namespace
 in /Applications/renpy/renpy.app/Contents/MacOS/../../../lib/darwin-x86_64/lib/python2.7/lua.so

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Adding "other" libraries to Ren'Py

#2 Post by PyTom »

You need to link against a wide unicode (UCS4) build of Python, which is what Ren'Py ships with. You built against a narrow build, which is why you have this problem.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

nintendotoad
Regular
Posts: 42
Joined: Sat Mar 31, 2012 2:56 pm
Location: projectexist.net
Contact:

Re: Adding "other" libraries to Ren'Py

#3 Post by nintendotoad »

That's what I had figured - but:

* if I'm on Mac OS X, Ren'Py 6.99.3.404, sys.maxunicode is 1114111
* if I'm on Windows, Ren'Py 6.99.5.602, sys.maxunicode is 65535

Is this me doing something wrong (or that's to be expected, and libraries for Windows should be built against UCS2 Python)?

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Adding "other" libraries to Ren'Py

#4 Post by PyTom »

Yeah, that's to be expected. The windows python build defaults to 16-bit.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

nintendotoad
Regular
Posts: 42
Joined: Sat Mar 31, 2012 2:56 pm
Location: projectexist.net
Contact:

Re: Adding "other" libraries to Ren'Py

#5 Post by nintendotoad »

It looks like for one (POSIX? Cygwin? MinGW?) reason or several others, the libraries I was looking at couldn't actually work with Ren'Py when compiled for Windows (at least in the way that I was trying to build them):

https://pypi.python.org/pypi/lupa
https://pypi.python.org/pypi/lunatic-python-bugfix
https://code.google.com/p/lupy/

... Well that's 6 hours I'll never get back...
... Actually, Lupa works :)

Post Reply

Who is online

Users browsing this forum: No registered users