Python Scripts

I have update my HA (0.49.1) and i have enable Python_Scripts with example Hello Word but not run … no message … how i can test it ?

thank you

Matteo

Check this thread.

this is the log:

2017-07-26 16:19:13 WARNING (Thread-5) [requests.packages.urllib3.connectionpool] Failed to parse headers (url=http://192.168.0.107:82/snapshot.cgi?user=admin&pwd=admin): [MissingHeaderBodySeparatorDefect()], unparsed data: ‘Tue, 12 Jun 2012 01:56:34 GMT\r\nContent-Type:image/jpeg\r\nContent-Length:33192\r\nConnection: close\n\n’
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py”, line 398, in _make_request
assert_header_parsing(httplib_response.msg)
File “/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/util/response.py”, line 66, in assert_header_parsing
raise HeaderParsingError(defects=defects, unparsed_data=unparsed_data)
requests.packages.urllib3.exceptions.HeaderParsingError: [MissingHeaderBodySeparatorDefect()], unparsed data: ‘Tue, 12 Jun 2012 01:56:34 GMT\r\nContent-Type:image/jpeg\r\nContent-Length:33192\r\nConnection: close\n\n’

thank you

What does your script do? Please paste the code and please do use proper Markdown. https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code-and-syntax-highlighting

I tried the example:
https://home-assistant.io/components/python_script/ but it does not work.
I do not know how to proceed with debugging.

My goal is to recall python scripts saved in a specific folder

Did you even look at the thread I linked above?

Log in on now … but the result is this

File “/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py”, line 398, in _make_request
assert_header_parsing(httplib_response.msg)
File “/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/util/response.py”, line 66, in assert_header_parsing
raise HeaderParsingError(defects=defects, unparsed_data=unparsed_data)
requests.packages.urllib3.exceptions.HeaderParsingError: [MissingHeaderBodySeparatorDefect()], unparsed data: 'Tue, 12 Jun 2012 01:56:34 GMT\r\nContent-Type:image/jpeg\r\nContent-Length:33948\r\nConnection: close\n\n

Have you sat the correct log level? https://home-assistant.io/components/logger

No I did not change the level, I did not understand how it can be done:

Could I do this for example?

Service: logger.set_level
date:
Homeassistant.components: warning
Homeassistant.components.python_scripts: debug

I do not know what the function is

I am having the same issue as metju trying to run the sample “Hello” script.
I am reading Logger, but don’t understand where the Service Set.Level should reside. In the configuration.yaml?

As explained in the docs, to enable the logger in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
logger:
  default: info
  logs:
    homeassistant.components.python_scripts: debug

The application is great now, but switching to another script I did to send an email with gmail account does not work.
Are scripts having limitations? Can I include external libraries?
If I run my script manually through putty like this (sudo python3 /home/homeassistant/.homeassistant/python_scripts/Lib_GoogleApi.py
) Is the mail correctly sent ideas?

Thanks a lot for the time you are devoting !!

No, it is not supported to include external libraries. If you need full python scripting capabilities please have a look at AppDaemon.

Great !! Now I have installed and tested pip3 the operation of AppDaemon.
How do I get a hello.py script with AppDaemon from home assistant?