Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 config path TypeError: expected bytes, str found #28

Closed
joshughes opened this issue Jan 1, 2016 · 5 comments
Closed

Python 3 config path TypeError: expected bytes, str found #28

joshughes opened this issue Jan 1, 2016 · 5 comments

Comments

@joshughes
Copy link

With python3 I am seeing the following issue...

    options = ZWaveOption(
        config[DOMAIN].get(CONF_USB_STICK_PATH, DEFAULT_CONF_USB_STICK_PATH),
        user_path=hass.config.config_dir,
        config_path=str(config[DOMAIN].get('config_path',
                                       DEFAULT_ZWAVE_CONFIG_PATH),))
  File "/home/homeassistant/.pyenv/versions/3.4.2/lib/python3.4/site-packages/openzwave-0.3.0b8-py3.4.egg/openzwave/option.py", line 76, in __init__
    libopenzwave.PyOptions.__init__(self, config_path=config_path, user_path=user_path, cmd_line=cmd_line)
  File "libopenzwave.pyx", line 579, in libopenzwave.PyOptions.__init__ (src-lib/libopenzwave/libopenzwave.cpp:6874)
  File "libopenzwave.pyx", line 582, in libopenzwave.PyOptions.create (src-lib/libopenzwave/libopenzwave.cpp:6966)
TypeError: expected bytes, str found

I compiled from source using the INSTALL_ARCH.txt method.

I have compiled from source multiple times and can't seem to actually get this to work... I am wondering if it my be a CYthon issue.

The Cython version is...

Cython (0.22)

I also tried to compile from the master branch and not using that INSTALL_ARCH.txt method... It installed but I see the exact same issue.

@joshughes joshughes changed the title Python 3 config path.... Python 3 config path TypeError: expected bytes, str found Jan 1, 2016
@joshughes
Copy link
Author

I was able to fork the repo and hack my way through this.

https://github.com/joshughes/python-openzwave

I don't think this is PR worthy because i don't think it will support python 2 and 3. Hopefully it gives someone some idea of what is going on though... basically I replaced anything with string(s) with str.encode(s) and added a few methods I found from the following threads.

https://groups.google.com/forum/#!msg/cython-users/ofT3fo48ohs/rrf3dtbHkm4J

http://docs.cython.org/src/tutorial/strings.html

@partofthething
Copy link

I don't think this is an issue with Cython 0.23 thanks to some fixes they made in that version. With Cython 0.23 and Python 3.4, the python3 branch compiles just fine without the changes @joshughes made here once the changes suggested in #10 are made.

EDIT: Nevermind: mine compiled but did not run. @joshughes changes got it running for me. Cool.

@davidkuehner
Copy link

I ran exactly into the same issue as @joshughes today.
I compiled from source using the INSTALL_ARCH.txt method too.

@partofthething
Copy link

Hi @davidkuehner, I saw your comment on my blog. Try running git checkout python3 before building and you might get around this issue.

@bibi21000
Copy link
Member

Sould be fixed. Python3 related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants