RE: config for python on win98
Hi, Just to answer for a way to make *.py files executable: NOTE: Works on NT (NT4, W2K, WXP) I do not know if it works for Win98 but you can add PATHEXT to autoexec.bat to see: 1. Properties of "My Computer" 2. Advanced Tab 3. Environment Variables 4. Add ";.PY;.PYW" to PATHEXT system variable Now the next dos prompt you open should allow you to type for example "spam" instead of "spam.py" to run a script. For you last question you quote hello = "...\n ... " This syntax is not correct to have actual carriage returns (not \n's) in a string you need to triple quote eg: #-- multiline1 = "This string \nhas \n 3 lines" multiline2 = """This string also has 3 lines""" print multiline1 print multiline2 #-- Mark -Original Message- From: Christoph Basedau [mailto:[EMAIL PROTECTED]] Sent: 11 January 2003 15:53 To: [EMAIL PROTECTED] Subject: config for python on win98 Hello I am just starting with python and have some questions. - Is there a way to make *.py-Files executables in an Win98-Environment (like *.bat or *.com). I am reading the docs from python.org but most notes on system config are for unix, so i couldn't find the answer there. - is there somethin like a .profile-file(unix) for windows that loads all default modules/options when running a py- script, maybe a bat/ini file? - What is python best in? I mean, what do you use it for: shell scripts, building guis, something else? - what is the best way to get an overwiew on what python is, what the modules do. - where on the web can i find lots of python scripts for windows with lots of comments suited for dummies and newbies? - if you know 'windows scripting' with vbs, js, wsf and so on will it be easy to port your scripts to py? does the COM-extension support the same subset of objects, classes and so on like wsh? or is it a differnt story? - In the docs (py2.3.1) there is an example with strings multiline (3.2.1 in Tutorial): hello = "This is a rather long string containing\n\ several lines of text just as you would do in C.\n\ Note that whitespace at the beginning of the line is\ significant." print hello this doesnt work for me, when i paste the code to the Python IDE (ActiveState): Error: name 'hello' is not defined what do i have to do to print hello? thanks for your ansers+time Christoph -- "War does not determine who is right - only who is left." Bertrand Russell ___ ActivePython mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython ___ ActivePython mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython
Re: config for python on win98
Christoph Basedau wrote: Hello I am just starting with python and have some questions. - Is there a way to make *.py-Files executables in an Win98-Environment (like *.bat or *.com). I am reading the docs from python.org but most notes on system config are for unix, so i couldn't find the answer there. No, Win9x does not allow arbitrary filetypes to be labeled as executables. Your *.py files will always need to be invoked by 'python *.py' -- though you can get the Windows Explorer to do this automatically when double-clicking a .py file. (Note that you *can* make .py files executable in WinNT/2k/XP, as a previous respondent noted, and ActivePython does so by default. This is due to limitations of the Win9x interactive shell, which is the same shell used by DOS [command.com] -- the WinNT codebase uses an entirely different interactive shell [cmd.exe] which does not have this limitation.) - is there somethin like a .profile-file(unix) for windows that loads all default modules/options when running a py- script, maybe a bat/ini file? Environment variables can be set in your autoexec.bat, or you can create a batch file 'mypython.bat' which invokes python with specific options -- and you can even change the filetype association for .py files to point to your batch file instead of directly to the python interpreter. - What is python best in? I mean, what do you use it for: shell scripts, building guis, something else? Yes. (I use it for all of the above, and more.) - where on the web can i find lots of python scripts for windows with lots of comments suited for dummies and newbies? Try the Vaults of Parnassus (www.vex.net/parnassus) for generally useful scripts and tools, and Useless Python (www.uselesspython.com) for a great beginner-oriented site. - if you know 'windows scripting' with vbs, js, wsf and so on will it be easy to port your scripts to py? does the COM-extension support the same subset of objects, classes and so on like wsh? or is it a differnt story? Yes, the win32com extension will allow you to use any COM automation objects -- essentially, the same ones that you would use from Visual Basic. You can also drive the Windows Scripting Host from python. One caveat -- there are some things for which python pretty much requires having a type library, and python's handling of in/out parameters is somewhat different, but it's pretty easy to learn to translate VB/VBS calls into Python calls. - In the docs (py2.3.1) there is an example with strings multiline (3.2.1 in Tutorial): [...] this doesnt work for me, when i paste the code to the Python IDE (ActiveState): Error: name 'hello' is not defined what do i have to do to print hello? I think the problem here is that PythonWin (the IDE) doesn't deal well with multi-line pasting in the interactive window. That window operates in a very line-oriented manner, and giving it several lines at once seems to confuse it. If you simply retype the code in the interactive window, it should work fine. Alternatively, you can paste the code into a script window, and then save and run the script. Jeff Shannon Technician/Programmer Credit International ___ ActivePython mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython
RE: Problems - ActivePython 2.2.2-224 on Win2K (SP3)
nevermind on this one...i downloaded & installed the 'regular' python 2.2.2 release from python.org (+then the Win32 extensions) and now the PythonWin IDE works great. could this be a bug in ActivePython tho? Tom Churm [EMAIL PROTECTED] - Original Message - From: "Tom Churm" <[EMAIL PROTECTED]> To: "activepython" <[EMAIL PROTECTED]> Sent: Friday, January 10, 2003 11:23 PM Subject: RE: Problems - ActivePython 2.2.2-224 on Win2K (SP3) > o.k., i've now installed SP3 on Win2K and reinstalled ActivePython > 2.2.2-224, but the problem persists. > > i thought this might have something to do with the fact that i have phpGTK > installed also, but Tkinter's working, it's just the PythonWin IDE that > isn't. > > i like to use the PythonWin IDE for non-gui python scripting, so if anyone > has a clue what's going on here, i'm all ears. > > thanks, > > tom > - Original Message - > From: Tom Churm > To: a > Sent: Saturday, January 04, 2003 8:07 AM > Subject: Problems - ActivePython 2.2.2-224 on Win2K (No SP) > > > hi, > > i just installed ActivePython-2.2.2-224 on Windows 2000 (no Service Pack). > don't think it matters, but i'm running a multi-boot system and Python has > been installed on my (win2k) partition 'H:\' instead of 'C:\'. > > Python works, but not the PythonWin IDE. as soon as i open up the PythonWin > IDE i get a popup window labelled 'Traceback when executing InitInstance > handler'. the text inside this popup is as follows: > > File > "H:\Python22\Lib\site-packages\Pythonwin\pywin\framework\intpyapp.py", line > 163, in InitInstance > import interact > File > "H:\Python22\Lib\site-packages\Pythonwin\pywin\framework\interact.py", line > 26, in ? > import winout > File "H:\Python22\Lib\site-packages\Pythonwin\pywin\framework\winout.py", > line 228, in ? > import pywin.scintilla.view > File "H:\Python22\Lib\site-packages\Pythonwin\pywin\scintilla\view.py", > line 16, in ? > import bindings > File > "H:\Python22\Lib\site-packages\Pythonwin\pywin\scintilla\bindings.py", line > 6, in ? > import keycodes > File > "H:\Python22\Lib\site-packages\Pythonwin\pywin\scintilla\keycodes.py", line > 25, in ? > _better_names = [ > exceptions.AttributeError: 'module' object has no attribute 'VK_RETURN' > > please note that i've tried starting the ActivePython installer package and > running the 'Repair' option, as well as completely uninstalling ActivePython > and then reinstalling it (including deleting all Python registry items > before reinstalling), but it just ain't workin'. i hope noone's going to > suggest that i install a Win2k Service Pack...i'd like to avoid this, since > my system's running fine as it is. > > any help is greatly appreciated...oh, yeah - i'm 99% sure my ActivePython > installer package is not damaged, 'cause it's the same installation file > i've used to successfully install ActivePython on another Win2K computer. > > thanks, > > tom > > > > > > > > ___ ActivePython mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython