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
WinError87 when executing local on Connection #2142
Comments
Hi KantiCodes, Just to confirm, you have an SSH server running on localhost on port 8050, and the username you're wanting to connect to is 45502? Which SSH server are you using? If you open an SSH connection using the standard openssh client ( Cheers, |
Thanks so much for taking time to look at my problem :) No, I do not have an SSH running - my understanding was that until I only run c.local() the connection is not established and it's just as if I was using invoke. Sorry about that. To add a little background to what I want to do. I created invoke module and wrapped it into my own pip installing library: http://docs.pyinvoke.org/en/stable/concepts/library.html#reusing-invoke-s-cli-module-as-a-distinct-binary Here is a simplified example: I can install and access my wrapped "module" Now my goal:
As far as I understand @bitprophet designed fabric to be Invoke+, therefore I would like to keep my Invoke solution and add being able to connect over SSH to web servers. To wrap up: I am all new to this topic - let me know if my intentions are clear |
Gotcha - would you be able to provide the full stack trace please? I'd like to see what's happening further up the stack. |
From what I can see, this appears to be an invoke issue - cc'ing @jefftriplett I don't have a Microsoft Windows machine at hand to test this with I'm afraid. |
Sadly, I don't have a Windows machine to test either. I'm a little confused by using I would try using |
Thanks for your answer @jefftriplett. The reason why I would like to use fabric.local instead of the invoke.run is following:
Nonetheless I have seen some code examples where people were doing following:
So now I am a little bit confused which one to choose. I do understand though that using fabric.local() is equivalent to invoke.run() I just thought that's the way to go. |
@KantiCodes sorry for the confusion. I was mostly curious if one worked vs. the other to help us figure out if the issue was really Invoke or Fabric since neither of us has a Windows machine to test it on. |
No probs. To answer your question: Invoke works properly. |
Btw, could you elaborate on the screen shoot I sent? What do u think about using Fabric functionality inside invoke |
I'm convinced that the issue you're having is related to the Microsoft Windows executor, rather than anything odd happening between invoke and fabric invoking invoke. I'll spin up a Microsoft Windows test VM and have a play. For now, here's my findings: tasks.py: from invoke import task
from fabric import Connection
@task
def test(c):
c.run('echo test from invoke')
fab_c = Connection('localhost')
fab_c.local('echo test from invoke via fabric') fabfile.py is a symbolic link to tasks.py, meaning they're identical:
invoke output:
fabric output:
|
Hi @KantiCodes, I'm afraid I'm unable to reproduce this. The steps I took:
Even after replacing the Can you please provide a small, standalone Cheers, |
I do apologise, you're using Python 3.8.5; I'll grab that and test! |
Aha, this is definitely related to the Python version. I've managed to reproduce this issue using Python 3.8.5. |
I've also managed to reproduce this issue using Python 3.8.8 (latest 3.8). |
Even in the latest Python 3.9.2 released a couple of days ago. |
I've narrowed the issue itself down to |
It looks like this is a known issue. If I set I'll continue to investigate. |
…es, replacing with specific override to clear environment only for remote. Issue: fabric#2142 See also: 4358f34
…es, replacing with specific override to clear environment only for remote. Issue: fabric#2142 See also: 4358f34
…es, replacing with specific override to clear environment only for remote. Issue: fabric#2142 See also: 4358f34
Hi @KantiCodes, As a temporary test (please do not rely on this long-term), you could install fabric from the commit I pushed to see if this fixes the issue for you: python -m pip install git+https://github.com/davidjmemmett/fabric.git@f8cf9ad30efb773f055bf7c174ef98ba225405fc Cheers, |
Disclaimer: given the nature of this commit, there are potential security implications (whereby local environment variables have the potential to be transmitted unknowingly): i.e. it's not yet been reviewed. |
Hi @davidjmemmett, Considering what you wrote, for now I will just stick with Invoke instead of sub-classing. |
Thanks for triaging this David! I may be reading too fast but I don't see if we've found what changed in Python 3.8 to break this - the ultimate change you identified needs to happen regardless, but it's weird if Python 3.6 and 3.7 don't trigger the issue. @KantiCodes as David and Jeff noted, using "straight Invoke" is fine here, especially if it works around the issue for now. Eventually I do want "just use Fabric because you intend to do both local and remote things" to be a smooth experience - it's not there yet unfortunately. Mixing the two in the same code shouldn't be all that much more annoying for now, hopefully! I'm talking with David in his PR and I expect to merge it sometime, so let's close this to roll it into there. Thanks for the report! |
…es, replacing with specific override to clear environment only for remote. Issue: fabric#2142 See also: 4358f34
…es, replacing with specific override to clear environment only for remote. Issue: fabric#2142 See also: 4358f34
I also meet the same problem. In Python 3.8.5 with Fabric 2.6.9, I failed to execute local commend in CMD with either ctx.run or conn.local. @task The error message is, I solve this problem by manually merge the two commits. I hope that you can release a new version to fix this problem as many people use Python 3.8/3.9 now. |
Hello, I'm experiencing the same issue here with pythonpython 3.9.6 and fabric 2.6 (up to date according to poetry ?) but the issue is closed. Any pointer on how to address it ? |
There hasn't been a release for a while - @bitprophet |
I have this issue too (Windows10, Python 3.9.5, fabric 2.6.0). But if I understood the thread correctly, the problem appear only with local connection. I have with remote too, BUT only in
Output:
If I try put this into task, I got error:
Output:
Russian output, OSError: [WinError 87] |
Hi all, I`m new to Invoke and even newer to Fabric!
I have some functionality in Invoke and now I`m trying to make a similar demo using fabric
Following code results in WinError87

[WinError 87] Parameter is incorrect
I know it's probably caused by me misunderstanding something - but I`d really appreciate a hint :)
Setup:
Python 3.8.5
Fabric 2.6.0
The text was updated successfully, but these errors were encountered: