1

When reading the Python docs, many libraries/functions indicate they work differently, or not at all, depending on the operating system.

Most of the libraries depend on whether the OS is POSIX compliant, or Win32.

  • When using the SUA package with Windows-7, does this allow python to enable/alter those Posix-dependent features?

If so; Fully? Partially? Indeterminant/Untested?

If yes to any of the three previous cases, does python adopt the new posix-os behavior automatically, or does it assume standard win32-os (meaning it must be configured, or perhaps even compiled, to enable the Posix modes)?


Notes

  • I am currently using the SUA utils/SDK provided by Microsoft, with no additional third party at the moment.

  • For the record, I have used Cygwin/MinGW, and do find them very useful, but for the scope of this question, lets just say they cannot be deployed (even though I probably will later). I am trying to discover how deeply SUA really integrates, and whether or not that has any bearing on typical python installations.

user2097818
  • 1,821
  • 3
  • 16
  • 34

1 Answers1

1

No, installing Subsystem for Unix-based Applications (Windows Services for Unix) doesn't change the behaviour of a binary distribution of Python in any way. The version of Python you're trying to use would have to be specifically built to support the Windows POSIX subsystem in order to take any advantage of it.

Microsoft's POSIX subsystem is no different than Cygwin in this respect. If you download and install the standard Windows binary distribution of CPython, its behaviour won't change if you later install Cygwin. You'd have to download install the Cygwin version of CPython if you want your Python program to take advantage of Cygwin's Unix emulation environment. Note also that Cygwin version of Python loses much, if not all, of the Windows specific functionality of standard Windows version of CPython.

You should also be aware that many popular third party Python modules are dependent on C extension modules. These modules have to be built for the specific version of Python you're using. While many of these modules support the standard Windows CPython distributions, and few support Cygwin, you'd need to compile these yourself for the POSIX subsystem.

Ross Ridge
  • 38,414
  • 7
  • 81
  • 112
  • I didn't plan on compiling specifically for the POSIX sys, but rather I was hoping that python would adapt the sys/shell-environment it was called from. BUT, as I found after the OP, any calls to a Win32 *program* (which Python for Windows definitely is), effectively exits the *SUA shell* automatically and re-enters the Win32 env (cmd.exe). I misunderstood the SUA system to create a *magic bridge* between Win32<->Posix during program execution, but it seems more like a 1-way symlink, and the Win32 native app has no idea any of this is happening. – user2097818 Jul 25 '14 at 17:21
  • The SUA shell (eg. `sh`) is just a program running in the POSIX subsystem. On Windows every executable is tagged with the subsystem it requires. The executable will run in this system regardless of which subsystem its started from. (Note that Cygwin programs run in Win32 subsystem. They use a different strategy to emulate Unix.) – Ross Ridge Jul 25 '14 at 18:08