[Python] Convert POSIX->WIN path, in Cygwin Python, w/o calling cygpath

Discussão em 'Python' iniciado por Stack, Fevereiro 11, 2025.

  1. Stack

    Stack Membro Participativo

    I use a Python script, running in a Cygwin build of Python, to create commands issued to native Windows utilities (not Cygwin-aware). This requires conversion of path parameters from POSIX to WIN form before issuing the command.

    Calling the cygpath utility is the nicest way to do this, since it uses Cygwin to do what it's there to do, but it's also a little horrifying (and slow).

    I'm already running a Cygwin build of Python - so the code to do the conversion is present. It seems like there should be a Cygwin/Python specific extension that gives me a hook to this capability, directly in Python, without having to fire up a whole new process.

    Continue reading...

Compartilhe esta Página