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

Change hard coded /tmp to cross-platform tempfile #148

Closed
kazoob opened this issue Dec 21, 2017 · 2 comments
Closed

Change hard coded /tmp to cross-platform tempfile #148

kazoob opened this issue Dec 21, 2017 · 2 comments
Labels

Comments

@kazoob
Copy link

kazoob commented Dec 21, 2017

Pardon me as I am not a Python expert. I installed Python and python-miio on Windows. When running the following command:

mirobo status

I received the following errors in addition to the proper output:

ERROR:miio.vacuum_cli:Unable to read the stored msgid: [Errno 2] No such file or
directory: '/tmp/python-mirobo.seq'
ERROR:miio.device:Got error when receiving: timed out
WARNING:miio.device:Retrying with incremented id, retries left: 3
State: Charging
Battery: 93 %
Fanspeed: 60 %
Cleaning since: 0:10:25
Cleaned area: 4.71 m²
Traceback (most recent call last):
File "c:\python\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "c:\python\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Python\Scripts\mirobo.exe_main
.py", line 9, in
File "c:\python\lib\site-packages\click\core.py", line 722, in call
return self.main(*args, **kwargs)
File "c:\python\lib\site-packages\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "c:\python\lib\site-packages\click\core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\python\lib\site-packages\click\core.py", line 1031, in _process_resul
t
**ctx.params)
File "c:\python\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "c:\python\lib\site-packages\click\decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args[1:], **kwargs)
File "c:\python\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "c:\python\lib\site-packages\miio\vacuum_cli.py", line 98, in cleanup
with open(id_file, 'w') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/python-mirobo.seq'

As a test I modified the following line in "vacuum_cli.py" from:

@click.option('--id-file', type=click.Path(dir_okay=False, writable=True), default='/tmp/python-mirobo.seq')

To:

@click.option('--id-file', type=click.Path(dir_okay=False, writable=True), default='c:\\python-mirobo.seq')

And now it works fine!

@rytilahti
Copy link
Owner

This needs to be fixed indeed, thanks for reporting, it's nice to know that it works on Windows too!

@kazoob
Copy link
Author

kazoob commented Feb 9, 2018

Just thought I would mention that I got around to upgrading from 0.3.3 to 0.3.5, and this fix works great on Windows!

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

No branches or pull requests

2 participants