Closed 5up3rD4n1 closed 6 years ago
I found that the encode=None
at the lua runtime was the cause of the issue, but now I can't install the package.
lupa._lupa.LuaError: [string "<python>"]:2: module 'chdkptp' not found:
no field package.preload['chdkptp']
no file '/home/sd/Documents/HACKPLACE/chdkptp.py/chdkptp/vendor/chdkptp/lua/chdkptp.lua'
no file '/usr/local/share/lua/5.2/chdkptp.lua'
no file '/usr/local/share/lua/5.2/chdkptp/init.lua'
no file '/usr/local/lib/lua/5.2/chdkptp.lua'
no file '/usr/local/lib/lua/5.2/chdkptp/init.lua'
no file '/usr/share/lua/5.2/chdkptp.lua'
no file '/usr/share/lua/5.2/chdkptp/init.lua'
no file './chdkptp.lua'
no file '/home/sd/Documents/HACKPLACE/chdkptp.py/chdkptp/vendor/chdkptp/chdkptp.so'
no file '/home/sd/Documents/HACKPLACE/chdkptp.py/chdkptp/vendor/chdkptp/lua/chdkptp.lua'
no file '/usr/local/share/lua/5.2/chdkptp.lua'
no file '/usr/local/share/lua/5.2/chdkptp/init.lua'
no file '/usr/local/lib/lua/5.2/chdkptp.lua'
no file '/usr/local/lib/lua/5.2/chdkptp/init.lua'
no file '/usr/share/lua/5.2/chdkptp.lua'
no file '/usr/share/lua/5.2/chdkptp/init.lua'
no file './chdkptp.lua'
stack traceback:
[C]: in function 'require'
[string "<python>"]:2: in main chunk
Looks like the package is looking for the lua files at my relative path not inside the chdkptp installation path.
So... I forked the repo and made it compatible with python3
Just if someone find it useful, here is the repo:
https://github.com/5up3rD4n1/chdkptp.py
I'm closing the issue. Thanks! :) :+1:
Could you submit a pull request with your changes? I'd love to add Python 3 support, but I haven't used the library in a a long time and no longer have access to a camera that can run chdk :/
Sure, no problem!
Hi, I am using the Python3 fork of @5up3rD4n1 but after the installation I have the error
dynamic libraries not enabled; check your Lua installation
I see on some other group that you had the same issue, did you find a way to fix it?
Hello, I used the python3.7.4 fork @5up3rD4n1 also and did the installation. Also I have lupa 1.8. Everything worked except when I launch the test.py file.
I have a "Segmentation fault (coredumped)" So I tried to debug this with gdb :
0 0x00007ffff69b1421 in ?? () from /usr/lib/liblua5.2.so.5.2
1 0x00007ffff69aea89 in lua_error () from /usr/lib/liblua5.2.so.5.2
2 0x00007ffff69bfc88 in luaL_error () from /usr/lib/liblua5.2.so.5.2
3 0x00007ffff69c11ed in luaLcheckversion () from /usr/lib/liblua5.2.so.5.2
4 0x00007ffff69c12b4 in luaL_setfuncs () from /usr/lib/liblua5.2.so.5.2
5 0x00007ffff6ac1466 in luaopen_lfs (L=0x5555556a3c68) at lfs.c:886
6 0x00007ffff6acbc80 in luaopen_chdkptp (L=0x5555556a3c68) at chdkptp.c:2202
7 0x00007ffff6a71ac7 in ?? () from /usr/lib/liblua.so.5.3
8 0x00007ffff6a71cf3 in ?? () from /usr/lib/liblua.so.5.3
9 0x00007ffff6a71d51 in ?? () from /usr/lib/liblua.so.5.3
10 0x00007ffff6a6d7bc in lua_callk () from /usr/lib/liblua.so.5.3
I don't think it's relevant, so I used pycharm to debug test.py. Seems like the segfault come when I import chdkptp, so I went deep, and found that this line is causing the segfault :
self._rt.execute("""
require('chdkptp')
util = require('util')
util:import()
varsubst = require('varsubst')
chdku = require('chdku')
exposure = require('exposure')
dng = require('dng')
prefs = require('prefs')
fsutil = require('fsutil')
""".format(CHDKPTP_PATH))
Specially the require('chdkptp')
, because when I remove it (I know it's a must have line), I have this error (no more segfault):
lupa._lupa.LuaError: ../chdkptp.py/chdkptp/vendor/chdkptp/lua/chdku.lua:23: attempt to index a nil value (global 'sys')
Next solution I tried, I removed the modification done by @5up3rD4n1, which was :
self._rt = LuaRuntime(unpack_returned_tuples=True, encoding='latin-1')
So I put encoding = None
self._rt = LuaRuntime(unpack_returned_tuples=True, encoding=None)
But I have this issue :
lupa._lupa.LuaError: [string "
"]:3: attempt to concatenate a POBJECT value (global 'CHDKPTP_PATH')
I tried the chdkptp.py python2.7, it works.
To sump up, the segfault is caused by "require('chdkptp')" when the encoding is set to 'latin-1', but when there is no encoding we have the problem with the POBJECT.
I would like to make it fully compatible with 3.7 and with the last chdkptp, but this segfault issue is really annoying, do you have any idea?
Thank you! :)
Hi Baiter, I'm trying to import chdkptp with python 3.6 (I know it is not supported yet) but maybe you can help me out wit this.
So, StringIO is deprecated on Python3.6 so I try to 'hack' the system modules with
and I'm getting now the following Traceback when I import chdkptp
Do you have an idea how can I solve this?