On 4/20/23 15:47, Ralf M. wrote:
Hello,

when I run a script with a "normally" installed python, the directory the script resides in is automatically added as first element to sys.path, so that "import my_local_module" finds my_local_module.py in the directory of the script.

However, when I run the same script with embeddable python ("Windows embeddable package (64-bit)", download link https://www.python.org/ftp/python/3.11.3/python-3.11.3-embed-amd64.zip) the script directory is *not* prepended to the path, thus "import my_local_module" gives an ImportError.

This is intended behavior - the question comes up from time to time. The embeddable distribution is intended to be part of an application, not a general-purpose Python you can call for just anything.

There are a bunch of details here, for example:

https://github.com/python/cpython/issues/79022


--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to