-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
"Script" tasks not working on windows? #51
Comments
Hi @tcamise-gpsw, thanks for reporting this. I don't seem to be able to reproduce this issue, using git bash on Windows 11 running in VirtualBox. I'm not sure what could be happening here, as long as "python" is on your path I'd expect it to work (see relevant code) If you're able to debug it, or share anything potentially relevant about your environment then I'd be interested to see if there's something poethepoet can do to be more robust. I'll leave this issue open for a while in case more details come to light. |
I was just doing some shotgun print debugging and may have found something. If I print out the
If I just send this from git bash via:
I get:
If I remove the \n it works. The original test also works if I remove the \n from the script _handle_run I have no idea what the consequences of removing that \n are. Any ideas? |
If it is acceptable, i made a PR here with just that change. |
Hi @tcamise-gpsw, thanks for looking into this! I gotta say I'm still not sure what's going on here. Unfortunately the Hence the tests fail in CI, did they work fir you locally? I have a few ideas of how to tackle this, but since I don't know exactly what's required to reproduce it (and don't have direct access to a proper Window dev environment), I'll need some help verifying the solution(s). Are you game?
return (
f"type({classname},(object,),{"
+ ",".join(f'"{name}": {value!r}' for name, value in named_args.items())
+ "})"
) Does that work? |
Yes, I am game to continue debugging this. But I'll need to get back to you towards the end of the week. |
I just ran across a similar issue in another context and unfortunately discovered this issue too late. It would have saved me several hours of print debugging. The symptom is that script tasks executed via
cmd = (
sys.executable,
"-c",
"import sys; "
"from os import environ; "
"from importlib import import_module; "
f"sys.argv = {argv!r}; sys.path.append('src');"
f"\n{self.format_args_class(self.named_args)}"
f"import_module('{target_module}').{function_call}",
) The first option is not a proper solution, so I would like to ask that the second option be implemented. |
Hi @jasal82, thanks for the feedback. I'm keen to get to the bottom of these issues. Could you help me better understand exactly what is going wrong in your case?
Unfortunately I don't think always using sys.executable is a reliable solution. It'll work as long as poe is itself installed inside the poetry venv, but not if it's installed in another env or via pipx etc. Constructing the command with just "python" should result in python being executed in the correct environment if the path is set correctly. Poe uses one of three different strategies for ensuring the path is setup depending on the circumstances:
|
Hello. So this is actually working for me now. That is, I can run all of the script tasks on Windows. I did upgrade to the 0.13.1 so I'm assuming that this is what fixed it. In any case, feel free to close this if you want. |
I just pushed a minor refactor to the development branch that should avoid whatever the original issue was related to new lines in the generated python script. Closing this issue, please comment if it doesn't seem to be solved after the next release. |
Hello. I am not able to get a "script" task to actually run on Windows (git bash). For sanity testing, I am trying to just run the "poe" task from this repo. It is configured in your
pyproject.toml
as:I am running it via:
On windows, I get nothing:
On ubuntu, it works:
Am I doing something dumb here?
The text was updated successfully, but these errors were encountered: