#1302 closed defect (wontfix)

installing Python 3 breaks bin\tahoe on Windows

Reported by: davidsarah Owned by: davidsarah
Priority: major Milestone: 1.12.0
Component: packaging Version: 1.8.1
Keywords: windows regression setuptools python Cc:
Launchpad Bug:

Description (last modified by daira)

Installing native-Windows Python 3 breaks bin\tahoe, because it changes the registry association for 'Python.File' to the Python 3 interpreter. This results in syntax errors because tahoe.pyscript is not compatible with Python 3.

(The exact version/installer I used was "Windows x86 MSI Installer (3.2b2)" from http://www.python.org/download/releases/3.2/ .)

This is strictly speaking a bug in zetuptoolz, but only Tahoe uses zetuptoolz.

Workarounds:

  • bin/tahoe from a Cygwin prompt still works, because that uses the shebang line which is correct.
  • c:\python26\python bin\tahoe (or whatever the full path to Python 2.x is) works.
  • python bin\tahoe works if Python 2.x is on the PATH. The Python 3 installer does not change the PATH (either for the current user or the system-wide one).

Although building Tahoe-LAFS causes .pyscript to be associated with Python.File, it does not change the association for Python.File (intentionally, because that would be impolite!), so rerunning a build, install, or python setup.py scriptsetup does not fix the problem.

Change History (10)

comment:1 Changed at 2011-01-12T08:11:54Z by davidsarah

[Edited to give more explicit paths, since there are two tahoe.pyscripts, one in bin and one in support\Scripts.]

This is a regression in Tahoe-LAFS v1.8.0 relative to v1.7.1, caused by the fix to #1074. Before v1.8.0, bin\tahoe.exe (built from this source) would have run the Python executable from support\Scripts\tahoe-script.py's shebang line, which is the one used for the Tahoe build/install, so it would have worked for the same reason as it does from a Cygwin prompt.

So, my bad :-(

Possible solutions (that don't regress #1074):

  1. Have scriptsetup associate .pyscript\shell\open\command with the current Python interpreter (sys.executable when scriptsetup is run) rather than Python.File.
  2. Make bin\tahoe.pyscript work with "any" Python version, but use the Python executable from build time to run support\Scripts\tahoe.pyscript.
  3. Make bin\tahoe something other than a Python script (for example, a .bat or .cmd file).

Note that a. has the property that if you run build/install with version X of Python, then all copies of Tahoe for the current user (since v1.8.0) will then use version X, rather than just the one you're building/installing. That differs from the behaviour on other operating systems or from a Cygwin prompt.

I think b. is a bad idea; we eventually want to get rid of bin\tahoe.pyscript (at least Brian and I do). Also, it imports pkg_resources, so pkg_resources would also have to work in Python 3, which is impractical/too much work.

I tested c. with a bin\tahoe.cmd file containing

@C:\Python26\python.exe <full path to renamed tahoe.pyscript> %*

It worked once, and from then on failed silently. (I've seen this behaviour before with .cmd and .bat files on my system, and have never got to the bottom of it. Perhaps the Windows installation is just broken.)

In summary, I'm not sure how to fix this yet.

Last edited at 2011-01-12T08:14:30Z by davidsarah (previous) (diff)

comment:2 Changed at 2011-01-12T08:35:08Z by davidsarah

  • Keywords python added

It could also be argued that, since Python 3 is not compatible with Python 2, it is a bug in the Python 3 installer that it modifies the Python.File entry, rather than adding a Python3.File entry. The latter would have avoided the problem (no matter what the association is for .py).

http://bugs.python.org/issue4485 is somewhat relevant; I'll comment on that ticket or find/file a more specific one. However, we need a workaround anyway.

comment:3 Changed at 2011-01-13T02:56:06Z by david-sarah@…

In a8739c39ab59d64d:

(The changeset message doesn't reference this ticket)

comment:4 Changed at 2011-02-25T00:49:16Z by davidsarah

  • Milestone changed from undecided to soon
  • Owner changed from somebody to davidsarah
  • Status changed from new to assigned

See also #1371, which is caused by incorrect permissions on the Python.File key. Solutions a. or c. above would fix that problem as well. I intend to implement a.

comment:5 Changed at 2011-08-12T15:34:33Z by davidsarah

  • Milestone changed from soon to 1.10.0

comment:6 Changed at 2013-08-13T23:03:26Z by daira

  • Description modified (diff)
  • Milestone changed from 1.11.0 to 1.12.0

comment:7 Changed at 2016-01-15T18:04:59Z by daira

When we remove zetuptoolz and switch to newer setuptools, this will be fixed because the scriptsetup code will go away. (Newer setuptools generates a Windows executable, and if this causes any regressions then we'll try to fix them upstream.)

comment:8 Changed at 2016-01-15T18:05:17Z by daira

  • Resolution set to wontfix
  • Status changed from assigned to closed

comment:9 Changed at 2016-01-15T19:10:28Z by daira

  • Milestone changed from 1.12.0 to 1.11.0

comment:10 Changed at 2016-03-22T05:02:52Z by warner

  • Milestone changed from 1.11.0 to 1.12.0

Milestone renamed

Note: See TracTickets for help on using tickets.