Skip to content

Python3.6 compatibility  #6

@5up3rD4n1

Description

@5up3rD4n1

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.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sd/.pyenv/versions/3.6.0/lib/python3.6/site-packages/chdkptp/__init__.py", line 1, in <module>
    from chdkptp.device import ChdkDevice, list_devices, DeviceInfo
  File "/home/sd/.pyenv/versions/3.6.0/lib/python3.6/site-packages/chdkptp/device.py", line 3, in <module>
    import StringIO
ModuleNotFoundError: No module named 'StringIO'

So, StringIO is deprecated on Python3.6 so I try to 'hack' the system modules with

>>> import sys, io
>>> sys.modules['StringIO'] = io

and I'm getting now the following Traceback when I import chdkptp

>>> import sys, io
>>> sys.modules['StringIO'] = io
>>> import chdkptp
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sd/.pyenv/versions/3.6.0/lib/python3.6/site-packages/chdkptp/__init__.py", line 1, in <module>
    from chdkptp.device import ChdkDevice, list_devices, DeviceInfo
  File "/home/sd/.pyenv/versions/3.6.0/lib/python3.6/site-packages/chdkptp/device.py", line 8, in <module>
    from chdkptp.lua import LuaContext, global_lua, parse_table
  File "/home/sd/.pyenv/versions/3.6.0/lib/python3.6/site-packages/chdkptp/lua.py", line 141, in <module>
    global_lua = LuaContext()
  File "/home/sd/.pyenv/versions/3.6.0/lib/python3.6/site-packages/chdkptp/lua.py", line 92, in __init__
    self._setup_runtime()
  File "/home/sd/.pyenv/versions/3.6.0/lib/python3.6/site-packages/chdkptp/lua.py", line 100, in _setup_runtime
    """)
  File "lupa/_lupa.pyx", line 262, in lupa._lupa.LuaRuntime.execute
  File "lupa/_lupa.pyx", line 1279, in lupa._lupa.run_lua
  File "lupa/_lupa.pyx", line 1288, in lupa._lupa.call_lua
  File "lupa/_lupa.pyx", line 1314, in lupa._lupa.execute_lua_call
  File "lupa/_lupa.pyx", line 1250, in lupa._lupa.raise_lua_error
lupa._lupa.LuaError: [string "<python>"]:3: attempt to concatenate global 'CHDKPTP_PATH' (a userdata value)
stack traceback:
	[string "<python>"]:3: in main chunk

Do you have an idea how can I solve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions