Skip to content

Commit 2473a1d

Browse files
committed
updated sys.path.append example with anabsolute path
1 parent b2cc103 commit 2473a1d

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

docs/new_features.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ Bug fixes since 1.1.0 include:
8484
- Inner functions and classes are added to global symbol table if declared as ``global``.
8585
- Pyscript user-defined functions (which are all async) can now be called from native python async
8686
code; see #137.
87-
- Calls to ``open()`` now set ``encoding=utf-8`` so Windows platforms use the correct encoding;
88-
see #145.
87+
- Internals that call ``open()`` now set ``encoding=utf-8`` so Windows platforms use the correct
88+
encoding; see #145.
8989
- On Windows, python is missing ``locale.nl_langinfo``, which caused startup to fail when the
9090
locale-specific days of week were extracted. Now the days of week in time trigger expressions
9191
are available on Windows, but only in English; see #145.

docs/reference.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,12 +1437,14 @@ One way to do that is in one of your pyscript script files, add this code:
14371437
14381438
import sys
14391439
1440-
if "config/pyscript_modules" not in sys.path:
1441-
sys.path.append("config/pyscript_modules")
1442-
1443-
This adds a new folder ``config/pyscript_modules`` to Python's module search path. You can then add
1444-
modules (files ending in ``.py``) to that folder, which will contain native python that is compiled
1445-
when imported (note that none of the pyscript-specific features are available).
1440+
if "/config/pyscript_modules" not in sys.path:
1441+
sys.path.append("/config/pyscript_modules")
1442+
1443+
This adds the directory ``/config/pyscript_modules`` to Python's module search path (you should use
1444+
the correct full path specific to your installation). You will need to set the ``allow_all_imports``
1445+
configuration parameter to ``true`` to allow importing of ``sys``. You can then add modules (files
1446+
ending in ``.py``) to that folder, which will contain native python that is compiled when imported
1447+
(note that none of the pyscript-specific features are available in those modules).
14461448

14471449
Pyscript can install required Python packages if they are missing. Depending on how you run HASS
14481450
(eg, using a minimal Docker container) it might not be convenient to manually install Python packages

0 commit comments

Comments
 (0)