Comments (12)
Curses is used for the interactive mode (samsungctl -i
). I am afraid it's not available for Windows.
Please test if #32 fixes this issue for you. The pull request makes curses optional, so that you can use everything else except the interactive mode even without it.
from samsungctl.
i tried it and got the following error instead
ran py -m samsungctl
and py -m samsungctl --host 192.168.0.23 --port 8001 --method websocket key KEY_VOLUP
both gave the error..
Traceback (most recent call last):
File "C:\Users\xbmc\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\xbmc\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\xbmc\Downloads\samsungctl-pr-optional_curses\samsungctl\__main__.py", line 122, in <module>
main()
File "C:\Users\xbmc\Downloads\samsungctl-pr-optional_curses\samsungctl\__main__.py", line 92, in main
config = _read_config()
File "C:\Users\xbmc\Downloads\samsungctl-pr-optional_curses\samsungctl\__main__.py", line 30, in _read_config
directories.append(os.path.join(os.getenv("HOME"), ".config"))
File "C:\Users\xbmc\AppData\Local\Programs\Python\Python36-32\lib\ntpath.py", line 75, in join
path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not NoneType
from samsungctl.
So I guess os.getenv("HOME")
returns None
. I'm not surprised that it's not set on Windows, but might be that it's sometimes not available even on Linux (although usually it is). So this needs to be fixed. I'll make a pull request.
However, to properly support Windows and other operating systems, we should replace the whole config path list with something more generic or make OS specific paths.
from samsungctl.
I would help but i have only written like 20 lines of python (i find dynamic languages somewhat confusing), but i'm happy to test any changes you make.
But yes if i open py
and write
import os
str(os.getenv("HOME"))
it outputs 'None'
.
If i understand correctly os.getenv
tries to read a environment variable?
On windows i think we have a few diffrent alternatives where you can store configuration data.
"USERPROFILE"
Root directory of the user profile"APPDATA"
Location to store application data that will be synchronized between computers if same user logs in (requires a domain for the synchronization to take place)"LOCALAPPDATA"
Same as above without synchronization."ProgramData"
Here you can store data that is shared between all users.
from samsungctl.
I made #35 to fix this. Could you check how it works in Windows? Are the system-wide and user specific paths correct / meaningful in Windows?
from samsungctl.
Ill try it out later when i get home, i don't have a samsung tv at work.
I don't know if the Paths are correct or meaningful, i tried to run import appdirs
in my python console but it just gave me ModuleNotFoundError: No module named 'appdirs'
so i can't check what appdirs.user_config_dir()
and appdirs.site_config_dir(title)
resolve into on windows.
But when looking at the documentation for appdirs 1.4.3
it seems they will be stored in C:\Users\<User>\AppData\Local\<AppName>
and that seems like good place as any.
from samsungctl.
i tried and got the following result
py -m samsungctl --name test --host 192.168.0.23 --port 8001 --method websocket KEY_VOLUP
Traceback (most recent call last):
File "C:\Users\xbmc\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\xbmc\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\xbmc\Downloads\samsungctl-pr-appdirs\samsungctl\__main__.py", line 1, in <module>
import appdirs
ModuleNotFoundError: No module named 'appdirs'
from samsungctl.
You need to have appdirs
installed. Try pip install appdirs
.
from samsungctl.
Ok that solves that error, then i got the same error but for websocket
so i installed that 2.
Now i get the following error:
py -m samsungctl --name test --host 192.168.0.23 --port 8001 --method websocket KEY_VOLUP
Traceback (most recent call last):
File "C:\Users\xbmc\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\xbmc\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\xbmc\Downloads\samsungctl-pr-appdirs\samsungctl\__main__.py", line 119, in <module>
main()
File "C:\Users\xbmc\Downloads\samsungctl-pr-appdirs\samsungctl\__main__.py", line 97, in main
with Remote(config) as remote:
File "C:\Users\xbmc\Downloads\samsungctl-pr-appdirs\samsungctl\remote.py", line 10, in __init__
self.remote = RemoteWebsocket(config)
File "C:\Users\xbmc\Downloads\samsungctl-pr-appdirs\samsungctl\remote_websocket.py", line 21, in __init__
self.connection = websocket.WebSocket()
TypeError: __init__() missing 3 required positional arguments: 'environ', 'socket', and 'rfile'
Edit: this is the exact same error i get in Home Assistant
but i guess thats understandable as it uses this component.
from samsungctl.
Do you have websocket-client
installed? Which version is it? You may need to uninstall websocket
.
from samsungctl.
I had websocket (0.2.1)
installed, uninstalled it and installed websocket-client
instead and the error went away! now everything is working properly!
Thanks for your patience with me!
from samsungctl.
Hi
had exactly the same issue with getting HOME dir on windows, i did:
from pathlib import Path
home = str(Path.home())
in main.py, as described here: https://stackoverflow.com/questions/4028904/how-to-get-the-home-directory-in-python
and it worked
from samsungctl.
Related Issues (20)
- How to get full path apps icon ? HOT 3
- No success with MU6400 - UnhandledResponse HOT 1
- PermissionError: [Errno 13] Permission denied
- SamsTv
- I look that the Sec-WebSocket-Key inconsistent with the server response
- Problem insall CTL
- Samsung DM55E. Typical ports are not open
- Model : UE50NU7025 / Error: Connection refused HOT 5
- This repository is dead HOT 3
- Netflix app HOT 2
- Key code support access additional virtual keys on the TV screen
- Do you have a payload to send the Mouse movement?
- RangeError after sending many keys in a row
- TV not reacting on UE48H series
- I need your help
- ms.channel.unauthorized
- "ms.channel.unauthorized" While trying to connect to TV HOT 1
- Connection Refused HOT 2
- 제 깃허브를 보십쇼
- No connection could be made because the target machine actively refused it HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from samsungctl.