Windows paths with spaces in it break grokproject/buildout

Bug #315223 reported by Martijn Faassen
22
This bug affects 1 person
Affects Status Importance Assigned to Milestone
grok
Fix Released
Medium
Maurits van Rees
1.0
Fix Released
Medium
Maurits van Rees

Bug Description

grokproject installs the .buildout directory on Windows in the following location:

C:\Documents and Settings\<USERNAME>\.buildout

This path has a space in it. Something confuses either grokproject or eggbasket or buildout so that it leads to tracebacks like the ones attached by Jeroen below: the path seems to be cut off at the space character behind "Documents".

We need to investigate whether there is an easy fix for this in our code, or alternatively on Windows we need to install the .buildout directory somewhere else by default (such as in the root).

Changed in grok:
assignee: nobody → maurits-vanrees
importance: Undecided → Medium
milestone: none → 1.0
status: New → Confirmed
Revision history for this message
Jeroen Michiel (jmichiel) wrote :

I tried it outside a virtualenv based setup (on the 1.0a1 to be exact), and it happens there too.

Revision history for this message
Maurits van Rees (maurits-vanrees) wrote :

"I suspect that this issue may be somewhere in the eggbasket precompilation phase." Errr, eggbasket has no precompilation phase that I know off... :-) The mentioned py_compile.py file is not in eggbasket. Precompiling might be an option settable in the ~/.buidout/default.cfg file - not sure. I don't think I can do anything about it. Posting a traceback might give some pointers though.

BTW, note that since my move about two months ago I do not yet have an internet connection at home. And at my work we have not yet done any grok projects. And I am not using Windows. So it is hard for me to debug problems like this, sorry.

Revision history for this message
Martijn Faassen (faassen) wrote : Re: [Bug 315223] Re: Windows paths with spaces in it break precompile

I've put this in the eggbasket department because I know we didn't
have a problem with buildouts in windows before then (if at least you
create the buildout in a path without spaces in it itself). Of course
it might be something else.

Thanks for letting us know you're not very available to debug this,
Maurits. I'll try to bug other people about it.

Revision history for this message
Jeroen Michiel (jmichiel) wrote : Re: Windows paths with spaces in it break precompile

this is the output I get if I don't specify an eggs-dir:

(groktest) D:\groktest>grokproject Sample
Enter user (Name of an initial administrator user): grok
Enter passwd (Password for the initial administrator user):
Downloading info about versions...
Invoking zc.buildout...
Develop: 'D:\\groktest\\Sample\\.'
Installing eggbasket.
Getting distribution for 'grok==1.0a1'.
eggbasket: Distributions are not installed. A tarball will be downloaded.
eggbasket: Distributions are not installed. A tarball will be downloaded.
eggbasket: Downloading http://grok.zope.org/releaseinfo/grok-eggs-1.0a1.tgz ...
eggbasket: Downloading http://grok.zope.org/releaseinfo/grok-eggs-1.0a1.tgz ...
eggbasket: Finished downloading.
eggbasket: Finished downloading.
eggbasket: Extracting tarball contents...
eggbasket: Extracting tarball contents...
eggbasket: Installing eggs to C:\Documents and Settings\jm\.buildout\eggs which will take a while...
eggbasket: Installing eggs to C:\Documents and Settings\jm\.buildout\eggs which will take a while...
Getting distribution for 'grok==1.0a1'.
Traceback (most recent call last):
  File "C:\Python24\Lib\py_compile.py", line 164, in ?
    main()
  File "C:\Python24\Lib\py_compile.py", line 159, in main
    compile(filename, doraise=True)
  File "C:\Python24\Lib\py_compile.py", line 115, in compile
    f = open(file, 'U')
IOError: [Errno 2] No such file or directory: 'c:\\documents'
Traceback (most recent call last):
  File "C:\Python24\Lib\py_compile.py", line 164, in ?
    main()
  File "C:\Python24\Lib\py_compile.py", line 159, in main
    compile(filename, doraise=True)
  File "C:\Python24\Lib\py_compile.py", line 115, in compile
    f = open(file, 'U')
IOError: [Errno 2] No such file or directory: 'c:\\documents'
Traceback (most recent call last):
  File "C:\Python24\Lib\py_compile.py", line 164, in ?
    main()
  File "C:\Python24\Lib\py_compile.py", line 159, in main
    compile(filename, doraise=True)
  File "C:\Python24\Lib\py_compile.py", line 115, in compile
    f = open(file, 'U')
IOError: [Errno 2] No such file or directory: 'c:\\documents'
.
.
.

description: updated
Revision history for this message
Maurits van Rees (maurits-vanrees) wrote :

Can you go to your default.cfg and change the eggs-directory line to point to
"C:\Documents and Settings\<USERNAME>\.buildout\eggs" so *with quotes" added? That might work.

Revision history for this message
Jeroen Michiel (jmichiel) wrote :

trying that gave me this error:
OSError: [Errno 22] Invalid argument: 'D:\\grok\\Sample\\"C:\\Documents and Settings\\jm\\.buildout\\eggs"'
Probably because there is a check if the second is a ':' or something...

using
eggs-directory = C:\Docume~1\<USERNAME>\.buildout\eggs
works, however

Revision history for this message
Martijn Faassen (faassen) wrote :

See also Bug #317081 (which I marked as a duplicate of this one)

Revision history for this message
Maurits van Rees (maurits-vanrees) wrote :

I think I fixed this in r97358 (not released yet) with an extra check in the create_buildout_default_file in grokproject/utils.py:

     eggs_dir = os.path.join(default_dir, 'eggs')
     if not os.path.isdir(eggs_dir):
         os.mkdir(eggs_dir)
+ if sys.platform == 'win32':
+ import win32api
+ eggs_dir = win32api.GetShortPathName(eggs_dir)

Please check if this actually fixes it.

Revision history for this message
Maurits van Rees (maurits-vanrees) wrote :

As reported on 2009-02-28 I committed a change that should fix this windows issue but heard nothing from real-life windows users yet. Testing is welcome. Oh, the last two released grokproject versions (1.0a3 and 1.0a4) have this fix so I will mark this as 'fix released'. Please reopen if this does not fix it.

Some more windows issues were fixed in z3c.recipe.eggbasket 0.4.2 which I just released today. This package version is only used by grokproject trunk so that would need a release (and I do not have the right to make a grokproject release).

And yes, as you may have noticed, I am going through the issues assigned to me on launchpad. :-)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.