[Tutor] Windows, Python and me

dman dsh8290@rit.edu
Sun, 12 Aug 2001 18:31:15 -0400


On Sat, Aug 11, 2001 at 01:12:50PM +0400, Roman Suzi wrote:
| Hello,
| 
| I am not sure if my question fits here, but I see lots
| of such questions in c.l.p and probably this one could
| gather expert answers, easily found later via google.
| 
| Keywords: Python Win32 Windows DOS prompt path setup start run install
|           CRLF edit editor IDLE
| 
| For more than 4 years already I am working with Linux. But in order to do
| packaging of Python related material I need to make it "right" in Windows.
| 
| And here I understand how difficult things in Windows are (compared to
| Linux). Below I refer to Win98 SE.

Uh huh.  I know what you mean (even though I learned DOS 3.3, Win
3.11, and Win95/98 before switching to linux).

| 1. After installing Python under Windows, I can't just type "python" in
| DOS-prompt to run scripts. What is the easy way for the novice to set PATH
| correctly? ("> start python" works fine).

If (I don't know if it does) the installer addes it to the PATH (via
modifying c:\autoexec.bat) you need to reboot for it to take effect.
In any case there is a shortcut in the Start menu to get a python
shell.  Also the installer sets up file associations so that if you
just double click a .py file it runs it.  Note, however, that .py
files always have a DOS box while running.  If you use .pyw instead
(for the 'main()' file) you won't get the DOS box.  A windows
pecularity.
 
| 2. Some tar.gz archives are using LF-line ends (and this is right thing
| for UNIX or under IDLE). However, such scripts are not editable in NotePad
| which is fabulous default Windows editor. What is the better choice:
| to get/provide CR-LF-ed text files or (how?) make users decode text files
| for themselves?
| 
| The deadlock is: NotePad can't be used due to LF-ed py-files and IDLE
| internal editor can't be used because IDLE doesn't support non-latin-1
| chars... I could suggest Emacs, but for beginners... They will be
| pissed off not only for Emacs, but Python alltogether. This way or that
| solution must be "freely distributable".

Wordpad (also in the Start->Accesories folder) can handle LF line
endings.  Notepad can "handle" them, but it displays the line ending
as a black box instead of going to the next line.  Not really pretty.
A python script to convert is really simple (basically s/\n/\r\n/).

| 3. What is the preferred way to run setup.py script? (MS DOS prompt
| doesn't work due to the problem no 1 above and if it works, how do I open
| MS DOS prompt in the needed directory and not in the C:\WINDOWS> ? (using
| cd or adding some bat or pif files to the directory with unzipped contents
| is not an option: it makes feel like Python doesn't suit into Windows
| environment well). Or do I need to get some freeware kind of Norton Editor
| for such tasks? (What Windows "Explorer" is for, then?)

Tell them to double click the .py file and it should run.  The
downside is that the DOS box goes away as soon as python exits so you
may want to add 

    raw_input( "Press Enter when done to close the window" )

to the end of the script.

| I think, these questions have impact on Python usability under Windows.
| Probably, the best solution could be adding GUI to Distutils, so running
| JUST setup.py without options will bring up a dialog with all available
| options or at least a text-prompt for them (like this is done for Mac
| which do not have command line).

Windows provides the text-prompt in the form of a DOS window.  I think
you are talking more about the usability of Windows than of the
usability of Python on Windows <0.1 wink>.
 
| The reason I posted this to Tutor is that probably I need to learn more
| about Windows+Python to resolve problems stated above. And yes, I have
| read Distutils docs. (please, tell if I need to reread them).

Just try something (simple) and ask a non-programmer windows user if
it makes sense to them.  If not talk with them to see what they expect
instead.  Unfortunately they can't just 'apt-get your_python_app'.
 
| Thank you for answers!

You're welcome.


BTW  WinZip is free only if you ignore the nag screens.  It can handle
tarballs just fine though.  Power Archiver is a similar program that
is free (and handles tarballs) and I think it is better.  A google
search will find it quickly.  The left-hand pane in Power Archiver
allows you to easily browse through the filesystem or the directories
in an archive similar to windows explorer.

-D