New submission from Sascha Fuhrmann <[email protected]>:
For my python development I have several directories on my Windows system:
common:
F:\python\scripts -> one-file-scripts based on python 2
F:\python\scripts3 -> one-file-scripts base on python 3
projects:
F:\python\projects\timetracking
...
Each directory has its own virtual environment (managed with pipenv):
F:\python\scripts\.venv
F:\python\scripts3\.venv
F:\python\projects\timetracking\.venv
Because I want to be able to call the scripts from everywhere, I added the
directories to the path-environment variable.
[...]F:\Python\scripts3;F:\Python\projects\timetracking[...]
Let's have a look at the timetracking project. The main script
(timetracking.py) has the following shebang-line:
#! /usr/bin/env .venv/scripts/python.exe
My current directory is the root of C
When I call 'timetracking.py' I get an error that some modules have not been
installed.
With activating the debug mode (set PYLAUNCH_DEBUG=1) I get some more
information:
***
C:\>timetracking.py
launcher build: 32bit
launcher executable: Console
File 'C:\Users\itsme\AppData\Local\py.ini' non-existent
File 'C:\Windows\py.ini' non-existent
Called with command line: "F:\Python\projects\timetracking\timetracking.py"
maybe_handle_shebang: read 256 bytes
maybe_handle_shebang: BOM not found, using UTF-8
parse_shebang: found command: F:\Python\scripts3\.venv\scripts\python.exe
run_child: about to run 'F:\Python\scripts3\.venv\scripts\python.exe
"F:\Python\projects\timetracking\timetracking.py" '
Traceback (most recent call last):
File "F:\Python\projects\timetracking\timetracking.py", line 18, in <module>
import menu_definitions
File "F:\Python\projects\timetracking\menu_definitions.py", line 15, in
<module>
import menu_edit_item_functions
File "F:\Python\projects\timetracking\menu_edit_item_functions.py", line 15,
in <module>
import tools
File "F:\Python\projects\timetracking\tools.py", line 19, in <module>
from texttable import Texttable
ModuleNotFoundError: No module named 'texttable'
child process exit code: 1
***
As you can see, the pylauncher found a shebang - but not that one I expected
('scripts3\.venv' instead of 'timetracking\.venv') *confused*
It seems that the pylauncher uses the first .venv it found within the path
variable...
Any ideas?
----------
components: Windows
messages: 323278
nosy: Sascha Fuhrmann, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Wrong virtual environment found
type: behavior
versions: Python 3.6
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue34359>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com