[kforge-dev] windows problem creating database

Rufus Pollock rufus.pollock at okfn.org
Thu Aug 10 20:30:09 UTC 2006


To follow up to John's comments.

Nikolas Bowe wrote:
> Hi,
>  
> when installing kforge 0.11 (latest stable) on windows I get the 
> following error when attempting to create the database
>  
> C:\django\kforge>python \Python24\Scripts\kforge-admin db create
> Command createdb requires 'kforge' user authentication:
> Command failed. Details: Could not execute command
>         [createdb -h localhost -U kforge kforge ]
> Reason: '{' is not recognized as an internal or external command,
> operable program or batch file.
>  
> yet creating the db manually works
> C:\django\kforge>createdb -h localhost -U kforge kforge
> Password:
> CREATE DATABASE
>  
> I tracked it to command.getstatusoutput
> it looks to be this old bug
> http://mail.python.org/pipermail/python-bugs-list/2002-January/009737.html

Well done on tracking this down!

> Interestingly the command also fails with the same error under cygwin 
> (using windows python not cygwin python).
> it makes sense because os.popen probably looks for the platform 
> (windows/cygwin) command shell so it still gets back cmd.exe from 
> windows python.
> But it still suprised me when I was trying to track it down.

I think you're probably right. I haven't used windows for several years 
now so I can't add much to what the sizable amount you already seem to 
have worked out.

> I didnt try with cygwin python.
>  
> is kforge meant to work on windows? are there plans for it to run on win?

We never formally discussed this but I think it is fair to say that 
we've assumed KForge would be running on 'nix based server (all of our 
testing and deployment so far has been on such systems). Given the 
server-oriented nature of the software (web administration of projects 
and associated servces) I think we'd assumed that was the major 
user-base. That said, you're demonstrating this need not be the case 
(and that it might not be that hard to get it working)

> is there a recommended fix for this issue ?
> I dont really want to patch my python if i can help it.

As John says you can create the db by hand. You'd then want to run:

$ kforge-admin db init

To populate the db with default data.

>  
> also when the kforge.conf file is created it processes escape codes.
> ie should be
> templates_dir = c:\python24\share\kforge\templates\kui
> but is
> templates_dir = c:\python24\share\kforge    emplates\kui
> this will probably happen on all platforms but I didnt take a look at 
> the code.
> this is probably easy to fix.

What is happening here is you are opening a the configuration template 
file doing string substitution and writing again. On the rewrite \t is 
being expanded to tab. The relevant code is in:

http://project.knowledgeforge.net/kforge/svn/tags/kforge-0.11/src/kforge/utils/admin.py

(if you are using 0.11) and the configuration writing is in:

InitialiseEnvCmd.generateConfiguration

This won't happen on any other platforms because paths usse '/' rather 
than '\'

Regards,

Rufus Pollock




More information about the kforge-dev mailing list