-
Notifications
You must be signed in to change notification settings - Fork 42
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
Support Python under Win10 #145
Comments
As you discovered, pyscript hasn't been tested on Windows. That particular code gets language (locale) specific strings for days of the week. Is there some other way to get that in Python on Windows? You could temporarily hardcode it in English to at least see whether there are subsequent Windows-related issues. |
Hardcode below. No error. But if user's Windows language is not English(US) will it be a problem?
|
Another error is pyscript cannot handle multi-bytes character? Logger: custom_components.pyscript load_scripts: skipping C:\Users\Alex\AppData\Roaming.homeassistant\pyscript\example.py due to exception 'gbk' codec can't decode byte 0xaf in position 199: illegal multibyte sequence |
I guess we could hardcode the days-of-week on Windows, but, yes, it would only be in English. For the 2nd error, Python should be expecting unicode with utf8 encoding. Do you know the encoding of your files on Windows? What are the hex byte values around byte #199? |
It's not a file encoding issue. The py file encoding is utf8 no BOM. This error happen when I use the example code in tutorial to call tts.google_translate_say service. If I pass a multi-byte string to the "message" parameter of google_translate_say, no matter Japanese, Chinese, Korean or Thai, the example.py script cannot be loaded. @service Same file but pass an English string to message is fine. |
Can you try something simpler, eg just do this: log.info('นี่คือการทดสอบ') That works for me on MacOSX. |
No, still the same. I have tried to change Windows Display language to English, but the error is the same, so it's not related with system locale. |
It looks like on windows |
OS: Win10
Python: 3.8.6
Error Msg below due to Windows doesn't support nl_langinfo:
Traceback (most recent call last):
File "d:\homeassistant\lib\site-packages\homeassistant\config_entries.py", line 236, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "C:\Users\Alex\AppData\Roaming.homeassistant\custom_components\pyscript_init_.py", line 123, in async_setup_entry
TrigTime.init(hass)
File "C:\Users\Alex\AppData\Roaming.homeassistant\custom_components\pyscript\trigger.py", line 142, in init
cls.dow2int[locale.nl_langinfo(getattr(locale, f"ABDAY_{i + 1}")).lower()] = i
AttributeError: module 'locale' has no attribute 'nl_langinfo'
The text was updated successfully, but these errors were encountered: