Python and WINE

Posted by Rakon on Sat 29 Dec 2007 02:24 AM — 9 posts, 38,459 views.

USA #0
Greetings all!

This may or may not come as a helpful hint to anyone, but I've finally taken the time to find a simple solution to the scripting in python issue, for MUSHclient and WINE.

So with this, I hope to create a small tutorial in order to help others, who'd rather use Python with MUSH under wine, rather then resorting to re-writing your code in LUA.(Sorry Nick!)

WINE V:0.9.46
MUSH V:4.19

First of all, download ActivePython, for your type of system(Win version, 32b or 64b), and install it within your .wine directory, say, drive_c.

http://www.activestate.com/store/download.aspx?prdGUID=b08b04e0-6872-4d9d-a722-7a0c2dea2758


Download :http://www.dll-files.com/dllindex/dll-files.shtml?msvcirt
And place it within the windows/system directory of WINE.

Open a terminal and navigate to where the ActivePython MSI is located.
Execute the following:

$ msiexec /i <activepythonfile>.msi

After it is installed, you may close the terminal window.

Open the .wine/drive_c/python## folder, copy the python##.dll file, to the windows/system directory of WINE.

Open a browser, and download the appropriate pywin32 file for your version of Python, from here:
http://sourceforge.net/project/platformdownload.php?group_id=78018

After pywin32 is completely installed, and MUSHclient is installed, then you should be able to select Python as your scripting language, in MUSH.

Granted, there still seems to be a few limitations to MUSH under WINE, such as the infobar will not render text properly, and has a few buggy issues with loading plugins. But aside from that, python scripting should work as it would under Windoze, and all without the /wine argument!

Enjoy!
Amended on Sat 29 Dec 2007 02:25 AM by Rakon
Netherlands #1
Useful post! Thanks. I'm yet one step closer to switching to Linux on a more daily basis it seems. :D
#2
This sounds awesome!

Could you please be more specific about the plugin loading issues?
#3
I followed the instructions posted by Rakon, and was able to get Python 2.5 scripting working in Ubuntu 8.04, with Wine 1.0.

pyWin32 did not seem to be necessary.

I've only done simple tests, but I made a dictionary object, and wrote some aliases to mess around with it (adding and deleting keys from it), which all seem to work.
USA #4
Glad to see you got everything working there Elin!

Regarding pyWin32, I needed that because of my 64bit system I believe. So if you're running a 32bit system, after installing python you'll already have the libs needed for MUSH to register python's existence. For the plugin loading issue, when I tested it, MUSH would crash on trying to load a plugin written in python, regardless of which scripting language was chosen.
#5
Ah.That seems like a pretty big issue, but it didn't seem to happen when I loaded my Python plugin. Of course, the one I wrote was very simple, and only contained a few aliases.

I'm glad I don't need pyWin32. When I tried to install it, it opened a process I wasn't able to kill.
#6
What happens if you import python libraries? Like re, threading, pickle? And where do you store custom libs? Do you put them in the side-package of the installed python version?

Thanks in advance
Aryzu
Australia Forum Administrator #7
I don't know myself. I was hoping someone else would.

There is no particular Python-specific code in MUSHclient, except that it loads Python when requested as one of the script engines (DLLs). Things like where libraries are stored, or how you import them, is done in whatever way Python scripting normally does, whatever that is.
USA #8
Aryzu:

Importing modules works fine, as long as they are in the WINE python, not under you actual posix system.

At least, this has been my experiance thus far, YMMV.