Coder Social home page Coder Social logo

wexpect fails in venv about wexpect HOT 8 OPEN

raczben avatar raczben commented on August 19, 2024 3
wexpect fails in venv

from wexpect.

Comments (8)

Stefanhg avatar Stefanhg commented on August 19, 2024 1

@jgentil I think the package development is completely dead.
I have done a PR which haven't been merged yet.

My conclusion with this is that it does not always work as if you run multi or single user Python install it still breaks. I think the conclusion was with Python multi user install if you don't run cmd in admin it will install packages in AppData because of write permissions to C:/Program files so therefore it will create 2 Python locations which breaks it.

It sucks as I have some CLI things to test on Windows.

from wexpect.

raczben avatar raczben commented on August 19, 2024

The root-casue will be around process launching.
When the host process starts the console process, gets wring pid. the self.conpid is different than ConsoleReader's os.getpid()
Enable logging, to see more details.

Host's self.conpid matches with ConsoleReader's os.getpid() if wexpect not runs from venv.

from wexpect.

raczben avatar raczben commented on August 19, 2024

This is the root cause.

from wexpect.

akent avatar akent commented on August 19, 2024

This fix in dev branch seems to work well. Any chance of a new release?

from wexpect.

ddeel avatar ddeel commented on August 19, 2024

It looks like this Issue has also turned into a problem for virtualenv...

I ran into a situation where wexpect programs that worked well on a system with an older virtualenv environment do NOT work on systems with newer virtualenv environments. In the newer virtualenv environments, wexpect programs always fail with the same pywintypes.error that says 'The system cannot find the file specified.'

After some debugging, I discovered that wexpect programs still work correctly on all my systems if virtualenv is not used. (But this is not very desirable for me.)

Looking at the virtualenv changelog, I found a note on Release 20.0.34 that says "Align with venv module when creating virtual environments with builtin creator on Windows 3.7 and later"; I'm thinking this means that starting with virtualenv 20.0.34, wexpect no longer works in virtualenv environments, because they'll have the same problem as venv environments.

My current work-around is to simply use virtualenv 20.0.30 for all my wexpect programs. It's not the latest version of virtualenv, but it seems to allow my wexpect programs to continue to work on all my systems, at least for now.

from wexpect.

raczben avatar raczben commented on August 19, 2024

Thank this comment,

The 850eece shows a way to solve this issue in all virtualenv. This implementation does not uses the child process' pid to identify the pip.

from wexpect.

wamsachel avatar wamsachel commented on August 19, 2024

The 850eece worked for me, thanks!

If anyone needs help, you can use the following cmd inside an activated venv to install the fix:

pip install git+https://github.com/raczben/wexpect.git@dev

from wexpect.

jgentil avatar jgentil commented on August 19, 2024

Please release this!

from wexpect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.