[moin-user] moin to dokuwiki export does not work, namespace error
Paul Boddie
paul at boddie.org.uk
Fri Dec 9 11:40:08 EST 2022
On Friday, 9 December 2022 16:22:33 CET Rudolf Reuter wrote:
> Hello,
> I have tried to convert my MoinMoin wiki v.1.9.9 to dokuwiki.
> There is a converter program available, but it does not work.
> Reference: https://github.com/glensc/moin2doku
> Unfortunately the author no longer want to give support.
This program is designed for Moin 1.5, so there may be compatibility issues
with various APIs. The Moin wiki syntax changed in Moin 1.6, if I remember
correctly, but if this converter uses the Moin parser API and if the dokuwiki
formatter is still usable for today's DocuWiki, then maybe it will produce
good enough results.
Amusingly, the DocuWiki page for that converter makes vague remarks about Moin
being "not as stable as it looks like" and links to a German language page
related to Ubuntu. Moin has been pretty stable since Moin 1.6 came out, I
would say.
One more general remark I would make is to consider the availability of tools
to migrate from DocuWiki rather than to it. If that scenario isn't great, you
may be saving up some pain in the future.
> In order to **make testing easier** I replaced in file moin2doku.py
> line 243
> opts, args = getopt.getopt(sys.argv[1:], 'hfad:p:r:i:I:', [ "help" ])
> with
> sys.argv[1:] = "-F wiki/data/pages/FrontPage" # RR "single page"
> parameter sys.argv[2:] = "-d out"
>
> Unfortunately there is a **namespace problem**.
>
> What I did to make it run:
> Copy the moin2doku files into the moinmoin installation.
I guess you have a directory containing the usual Moin distribution, with the
MoinMoin directory being the package that gets imported. If you put the
moin2doku files in that Moin distribution directory then I think it ought to
work. This should mean that when you run moin2doku.py it will find the
MoinMoin package and the different modules.
If, on the other hand, the MoinMoin directory lives in somewhere like site-
packages or dist-packages then I wouldn't copy the moin2doku files into the
same location. Instead, just rely on the PYTHONPATH/sys.path to help find the
MoinMoin package.
> I set all files to owner www-data:www-data
You only need to do this to publish the output of the conversion. Setting the
owner of these programs shouldn't be necessary, although you will need to make
sure that if you are running them as your own user, the permissions on the
files and on the Moin sources permit your user's access.
> Start moin2doku.py:
> **$ sudo python2 moin2doku.py**
And so it shouldn't be necessary to run this with superuser privileges.
> --- changes in moin2doku.py, use tabs only !
>
> When you start moim2doku.py , you get an error in file MoinMoin/user.py line
> 27 import md5crypt
>
> **ImportError**: no module named md5crypt
> Path: MoinMoin/support/md5crypt.py
>
> When you change line 27 from:
> import md5crypt
> to:
> import support.md5crypt
>
> This error is gone, but then comes the next namespace error.
This does look a bit strange.
> But the next import fails, and I did not found a solution.
> user.py line 38
> MoinMoin/util/filesystem.py
> module line 33: support.werkzeug.posixemulationn # support added
> ./MoinMoin/support/werkzeug/posixemulation.py
>
> I am still searching how to **fix the namespace error**.
Here, it would be useful to see the actual error message - the traceback - so
that we can better understand it and avoid misunderstandings. For example, it
is actually MoinMoin/util/filesys.py where the error arises.
> It would be very nice if someone with more knowledge could help me please.
For now, we may ignore the md5crypt error which may only manifest itself
because we are importing MoinMoin.user directly, and because who knows what
kind of weird module namespace stuff might be done when Moin is launched
normally to prevent it from happening? Again, I find the presence of the error
very odd, but then I'm not doing something like this myself very often any
more.
However, I would guess that the Werkzeug error may have something to do with
either a missing package for Werkzeug, the wrong version being installed, or a
problem finding it when run as superuser, which you probably shouldn't be
doing. Diagnosis involving sys.path could be helpful here.
I hope this is useful.
Paul
More information about the moin-user
mailing list