[Twisted-Python] Some Win32 comments

I was trying to get the Twisted IM client running, and have a few comments related to config issues on Win32. Here they are: 1 running 'python setup.py install' copies the twisted folder to the <python>\lib\site-packages folder, which is okay. but if you change to the Twisted<version> folder and do 'python bin\im', it will be using the sources from the original location, NOT the site-packages location. 2 similar to the above, if you set PYTHONPATH to point to Twisted<version> folder, as it says to do in the README, the original twisted files will be used, not those copied to the site-packages folder. so, given 1 & 2, do we really need to do the setup.py? It should be noted in the README(.win32?) that users should either: 1) set PYTHONPATH to Twisted<version> and NOT run setup.py, and include the full path to im, mktap, etc, or 2) do NOT set PYTHONPATH, run setup.py, and still include the fullpath to the bin folder. i would also suggest that the files in the bin folder have the .py extension, so that on Windows we can associate them to the python interpreter, which would simplify things. 3 im (Tk) fails to save config state, if HOME is not set, since the ~ will return exactly, and this is an invalid filename charcter under Win9x. Either split it to check, or put in an error/warning. here is a fix i made to mine, which should work on all platforms: tkim.py, line 912: path = ".imsaved" home = os.path.expanduser("~") if home != "~": path = home+os.sep+path Thanks, Tyler

On Sun, Mar 17, 2002 at 09:34:05PM -0400, Tyler W. Wilson wrote:
I'm thinking that the best solution is probably more like what PyChecker does. Basically, install the bin scripts into e.g. c:\python22\scripts, possibly as batch files that call the original scripts, possibly as the original scripts with ".py" added. I've found it useful to add the scripts directory to my %PATH% for pychecker, and so this (for me at least :) would make things like twistd automatically available to my command prompt. -Andrew.

On Sun, Mar 17, 2002 at 09:34:05PM -0400, Tyler W. Wilson wrote:
Hmm. It works fine for me on Win2k:
os.path.expanduser('~') 'C:\\Documents and Settings\\AndrewB'
Win98 really isn't meant to be a server OS, and Twisted is largely a library for writing servers. On the other hand, the IM is more of an end-user app, so probably should be more lenient about such things. You could also try using the Cygwin version of Python, which is more unix-like. I'm not sure if it has Tcl/Tk libraries, though... -Andrew.

Andrew Bennetts wrote:
Windows NT and above (Win2K, WinXP) do have a concept of users and home directories, so this is logical. Win9x does not really. Or maybe it is an issue with Python?
I lean towards the latter. I would like to do some work on the TkIM client in Twisted, to get some experience and 'give something back'. I always liked the Jabber approach (the protocols being handled on the server-side). But they did not keep the ICQ gateway up to date, so I stopped using it. But a Jabber protocol in Twisted may go further (and later perhaps have a Jabber server written in Twisted).
You could also try using the Cygwin version of Python, which is more unix-like. I'm not sure if it has Tcl/Tk libraries, though...
I will look for some binaries. I am not set up with cygwin at the moment, being on a slow-ass modem connection.

On Sun, 2002-03-17 at 20:34, Tyler W. Wilson wrote:
The README doesn't mention setup.py at all; it only mentions that you should set your PYTHONPATH environment variable.
Would it be better to detect if we're on windows and rename all the bin/ scripts to foo.py, or maybe include a set of supplementary .bat files that just ran 'python bin/foo.py'? I'll implement this either way. (if we go with the former option, it'll require win32 users to run setup.py, which is probably better any way) -- Chris Armstrong << radix@twistedmatrix.com >> http://twistedmatrix.com/users/carmstro.twistd/

Christopher Armstrong wrote:
True, but two items: 1) I believe it is 'standard procedure' to do a python setup.py for any new Python modules. And 2) I had asked on the IRC channels about this, and they said you shoulw run setup.py. So, I think it should be mentioned either way in the README.
Is there is an issue with just renaming them with a py extension on all platforms? I mean, they are Python source files. And all the other Twisted Python source files have .py extensions. I know you use these as scripts on *nix. And either way, on Windows you should note in the readme that the system PATH should include the Twisted bin directory. It doesnt mention this for Unix either, but I suppose it is needed, isn't it?

On Sun, Mar 17, 2002 at 09:34:05PM -0400, Tyler W. Wilson wrote:
I was trying to get the Twisted IM client running, and have a few comments related to config issues on Win32. Here they are:
Thanks for your feedback.
[snip stuff about setup.py]
The real problem here is that Windows isn't very command-line centric, so there's no clear way to do this. The UNIX procedure is to put bin/* in /usr/bin/ using your package manager (debian's "apt", for example). What we need is a win32 equivalent to the bin/* scripts -- probably a few .pyw files with trivial GUIs on them. Renaming these to e.g. twistd.py would cause several problems -- 1, twistd (et. al.) is not a python module and should not be importable with 'import'; 2, these scripts would apparently do nothing when invoked in Windows, unless you have them bring up a terminal window -- in which case they will do nothing but briefly flash a help message in a terminal window which will disappear. Rather than documenting the current state of affairs for win32 users, we ought to make things work in an appropriately windows-y way instead of relying on the fact that (some of) the stuff in bin/ just happens to run on Windows. Part of this Windows-centric experience of Twisted involves COIL being fully functional, which it is not yet; that's why we haven't started polishing up the distribution. Soon though :-)
Thanks for the fix -- Paul, any comments? :-) -- ______ you are in a maze of twisted little applications, all | |_\ remarkably consistent. | | -- glyph lefkowitz, glyph @ twisted matrix . com |_____| http://www.twistedmatrix.com/

On Sun, 17 Mar 2002 22:03:13 -0600, Glyph Lefkowitz wrote:
I think I volunteered some time ago (and never came around to it) to add distutils overloads for scripts like I have in my projects, and in RoundUp. If you don't want to go the GUI route directly, I can finally do it. Ciao, Jürgen

On Sun, Mar 17, 2002 at 09:34:05PM -0400, Tyler W. Wilson wrote:
I'm thinking that the best solution is probably more like what PyChecker does. Basically, install the bin scripts into e.g. c:\python22\scripts, possibly as batch files that call the original scripts, possibly as the original scripts with ".py" added. I've found it useful to add the scripts directory to my %PATH% for pychecker, and so this (for me at least :) would make things like twistd automatically available to my command prompt. -Andrew.

On Sun, Mar 17, 2002 at 09:34:05PM -0400, Tyler W. Wilson wrote:
Hmm. It works fine for me on Win2k:
os.path.expanduser('~') 'C:\\Documents and Settings\\AndrewB'
Win98 really isn't meant to be a server OS, and Twisted is largely a library for writing servers. On the other hand, the IM is more of an end-user app, so probably should be more lenient about such things. You could also try using the Cygwin version of Python, which is more unix-like. I'm not sure if it has Tcl/Tk libraries, though... -Andrew.

Andrew Bennetts wrote:
Windows NT and above (Win2K, WinXP) do have a concept of users and home directories, so this is logical. Win9x does not really. Or maybe it is an issue with Python?
I lean towards the latter. I would like to do some work on the TkIM client in Twisted, to get some experience and 'give something back'. I always liked the Jabber approach (the protocols being handled on the server-side). But they did not keep the ICQ gateway up to date, so I stopped using it. But a Jabber protocol in Twisted may go further (and later perhaps have a Jabber server written in Twisted).
You could also try using the Cygwin version of Python, which is more unix-like. I'm not sure if it has Tcl/Tk libraries, though...
I will look for some binaries. I am not set up with cygwin at the moment, being on a slow-ass modem connection.

On Sun, 2002-03-17 at 20:34, Tyler W. Wilson wrote:
The README doesn't mention setup.py at all; it only mentions that you should set your PYTHONPATH environment variable.
Would it be better to detect if we're on windows and rename all the bin/ scripts to foo.py, or maybe include a set of supplementary .bat files that just ran 'python bin/foo.py'? I'll implement this either way. (if we go with the former option, it'll require win32 users to run setup.py, which is probably better any way) -- Chris Armstrong << radix@twistedmatrix.com >> http://twistedmatrix.com/users/carmstro.twistd/

Christopher Armstrong wrote:
True, but two items: 1) I believe it is 'standard procedure' to do a python setup.py for any new Python modules. And 2) I had asked on the IRC channels about this, and they said you shoulw run setup.py. So, I think it should be mentioned either way in the README.
Is there is an issue with just renaming them with a py extension on all platforms? I mean, they are Python source files. And all the other Twisted Python source files have .py extensions. I know you use these as scripts on *nix. And either way, on Windows you should note in the readme that the system PATH should include the Twisted bin directory. It doesnt mention this for Unix either, but I suppose it is needed, isn't it?

On Sun, Mar 17, 2002 at 09:34:05PM -0400, Tyler W. Wilson wrote:
I was trying to get the Twisted IM client running, and have a few comments related to config issues on Win32. Here they are:
Thanks for your feedback.
[snip stuff about setup.py]
The real problem here is that Windows isn't very command-line centric, so there's no clear way to do this. The UNIX procedure is to put bin/* in /usr/bin/ using your package manager (debian's "apt", for example). What we need is a win32 equivalent to the bin/* scripts -- probably a few .pyw files with trivial GUIs on them. Renaming these to e.g. twistd.py would cause several problems -- 1, twistd (et. al.) is not a python module and should not be importable with 'import'; 2, these scripts would apparently do nothing when invoked in Windows, unless you have them bring up a terminal window -- in which case they will do nothing but briefly flash a help message in a terminal window which will disappear. Rather than documenting the current state of affairs for win32 users, we ought to make things work in an appropriately windows-y way instead of relying on the fact that (some of) the stuff in bin/ just happens to run on Windows. Part of this Windows-centric experience of Twisted involves COIL being fully functional, which it is not yet; that's why we haven't started polishing up the distribution. Soon though :-)
Thanks for the fix -- Paul, any comments? :-) -- ______ you are in a maze of twisted little applications, all | |_\ remarkably consistent. | | -- glyph lefkowitz, glyph @ twisted matrix . com |_____| http://www.twistedmatrix.com/

On Sun, 17 Mar 2002 22:03:13 -0600, Glyph Lefkowitz wrote:
I think I volunteered some time ago (and never came around to it) to add distutils overloads for scripts like I have in my projects, and in RoundUp. If you don't want to go the GUI route directly, I can finally do it. Ciao, Jürgen
participants (7)
-
Andrew Bennetts
-
Andrew Bennetts
-
Christopher Armstrong
-
Glyph Lefkowitz
-
Itamar Shtull-Trauring
-
j.her@t-online.de
-
Tyler W. Wilson