Re: making a python program in windows
rustom rustompm...@gmail.com wrote: Thanks for this (and all other) tips. Strangely now my m/c shows things exactly like so. A new .py file gets associated with python but two days ago it was with pythonw?! No, .py files are always associated with python.exe. .pyw files are associated with pythonw.exe. -- Tim Roberts, t...@probo.com Providenza Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list
Re: making a python program in windows
On May 21, 5:09 pm, Duncan Booth duncan.bo...@invalid.invalid wrote: rustom rustompm...@gmail.com wrote: i suppose the question is entirely about setting properly (and grokking) file associations -- why is a .py file associated with pythonw and not python? And is making this association right enough to make a .py file in windows behave like a shebang file in unix? I think the question about the file association is one you have to answer for yourself. When you install Python it associates .pyw with pythonw and .py with python. If something on your system has changed this the best thing you can do is to change it back. Try typing the following commands and then fixing any differences by typing the expected output as the command parameter (e.g. assoc .py=Python.File): C:\assoc .py .py=Python.File C:\assoc .pyw .pyw=Python.NoConFile C:\ftype Python.file Python.file=C:\Python26\python.exe %1 %* C:\ftype Python.NoConFile Python.NoConFile=C:\Python26\pythonw.exe %1 %* -- Duncan Boothhttp://kupuguy.blogspot.com Thanks for this (and all other) tips. Strangely now my m/c shows things exactly like so. A new .py file gets associated with python but two days ago it was with pythonw?! Any recos on where I could read up on this stuff? -- http://mail.python.org/mailman/listinfo/python-list
Re: making a python program in windows
rustom wrote: Thanks for this (and all other) tips. Strangely now my m/c shows things exactly like so. A new .py file gets associated with python but two days ago it was with pythonw?! Any recos on where I could read up on this stuff? I by all this stuff you mean: Windows file associations, then this would be the place: http://msdn.microsoft.com/en-us/library/dd758090(VS.85).aspx If you mean: what the Python installer does to set such things up, then there is some information here: http://docs.python.org/using/windows.html but not really covering the exact question you've been asking. You'd have to hunt around the archives of this mailing list and/or look at the msi source: http://svn.python.org/view/python/trunk/Tools/msi/msi.py?view=markup (and feel free to submit a doc patch if you think it might help) TJG -- http://mail.python.org/mailman/listinfo/python-list
Re: making a python program in windows
Tim Roberts wrote: Dave Angel da...@ieee.org wrote: Anyway, now you can see two batch files you could use to make a particular version of Python active. The first one uses assoc and ftype to fix the asssociations. And the other changes the environment variable PATHEXT to make the extension optional. Note that changing the environment variable is effective only for that DOS box, and its children. If you want a permanent change, you need to change the registry, probably at hklm\SYSTEM\ControlSet001\Contro/Session\Session Manager\Environment\PATHEXT The better way to do this is to bring up the System control panel applet (shortcut: WindowsKey + Pause/Break), Advanced, Environment Variables. In the System variables, click PATHEXT and Edit, and add ;.PY;.PYW to the end. Certainly that's how I'd do it. But the OP was averse to even using the OpenWith dialog to change the file associations. He wanted a commandline/batch/script way of doing it. So why would I give him the same kind of an answer for modifying environment vars? -- http://mail.python.org/mailman/listinfo/python-list
Re: making a python program in windows
Rustom Mody wrote: I know how to make a python script behave like a (standalone) program in unix -- 1. put a #! path/to/python as the first line 2. make the file executable The closest I know how to do this in windows is: r-click the file in win-explorer goto properties goto open with change pythonw to python Can someone enlighten me about a more scriptish way of doing this? Basically if I have to setup that program on other (windows) m/cs is there some .bat or .vbs or some regedit thingy Ive to do to avoid the Rt-click routine? Since you don't know for sure if a Python environment is available on the other windows machine and whether the file associations are configured correctly, the best thing you can do is to use something like py2exe and distribute the result of that. -- MPH http://blog.dcuktec.com 'If consumed, best digested with added seasoning to own preference.' -- http://mail.python.org/mailman/listinfo/python-list
Re: making a python program in windows
On May 21, 3:19 pm, Martin P. Hellwig martin.hell...@dcuktec.org wrote: Rustom Mody wrote: I know how to make a python script behave like a (standalone) program in unix -- 1. put a #! path/to/python as the first line 2. make the file executable The closest I know how to do this in windows is: r-click the file in win-explorer goto properties goto open with change pythonw to python Can someone enlighten me about a more scriptish way of doing this? Basically if I have to setup that program on other (windows) m/cs is there some .bat or .vbs or some regedit thingy Ive to do to avoid the Rt-click routine? Since you don't know for sure if a Python environment is available on the other windows machine and whether the file associations are configured correctly, the best thing you can do is to use something like py2exe and distribute the result of that. Oh - Oh! Not an exe please! I dont want to move away from readable text files if possible. I certainly know that python2.6 is installed. Why that installation by default does not put python.exe on the path I dont know but that is best corrected by hand. Bottom Line: Assume that from a command line (cmd) python runs and gives its interpreter prompt. When run from cygwin it hangs but thats another story. Just dont assume cygwin. i suppose the question is entirely about setting properly (and grokking) file associations -- why is a .py file associated with pythonw and not python? And is making this association right enough to make a .py file in windows behave like a shebang file in unix? [And is there a more appropriate list for such questions?] Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: making a python program in windows
Rustom Mody wrote: I know how to make a python script behave like a (standalone) program in unix -- 1. put a #! path/to/python as the first line 2. make the file executable The closest I know how to do this in windows is: r-click the file in win-explorer goto properties goto open with change pythonw to python Can someone enlighten me about a more scriptish way of doing this? Basically if I have to setup that program on other (windows) m/cs is there some .bat or .vbs or some regedit thingy Python can replace all of that ;-) But to your orginal question, why not change the file associate in windows ? cheers, Stef -- http://mail.python.org/mailman/listinfo/python-list
Re: making a python program in windows
rustom rustompm...@gmail.com wrote: i suppose the question is entirely about setting properly (and grokking) file associations -- why is a .py file associated with pythonw and not python? And is making this association right enough to make a .py file in windows behave like a shebang file in unix? I think the question about the file association is one you have to answer for yourself. When you install Python it associates .pyw with pythonw and .py with python. If something on your system has changed this the best thing you can do is to change it back. Try typing the following commands and then fixing any differences by typing the expected output as the command parameter (e.g. assoc .py=Python.File): C:\assoc .py .py=Python.File C:\assoc .pyw .pyw=Python.NoConFile C:\ftype Python.file Python.file=C:\Python26\python.exe %1 %* C:\ftype Python.NoConFile Python.NoConFile=C:\Python26\pythonw.exe %1 %* -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: making a python program in windows
Rustom Mody wrote: I know how to make a python script behave like a (standalone) program in unix -- 1. put a #! path/to/python as the first line 2. make the file executable The closest I know how to do this in windows is: r-click the file in win-explorer goto properties goto open with change pythonw to python Can someone enlighten me about a more scriptish way of doing this? Basically if I have to setup that program on other (windows) m/cs is there some .bat or .vbs or some regedit thingy Ive to do to avoid the Rt-click routine? Duncan told you about assoc and ftype, two programs that manipulate those associations (show and edit). But one more thing you may want if you work much from a command line: Look at the environment variable PATHEXT. If it doesn't have a .PY and .PYW, you might want to add them. That way when someone is typing a script name at the command prompt, they don't need an extension. Anyway, now you can see two batch files you could use to make a particular version of Python active. The first one uses assoc and ftype to fix the asssociations. And the other changes the environment variable PATHEXT to make the extension optional. Note that changing the environment variable is effective only for that DOS box, and its children. If you want a permanent change, you need to change the registry, probably at hklm\SYSTEM\ControlSet001\Contro/Session\Session Manager\Environment\PATHEXT This can be automated either with a .REG file, or with a few lines of Python code that manipulates the registry. The latter is better, because you can avoid disturbing the other extensions that will already be there. You can also manipulate the registry to get SendTo items on the context menu for .PY files, and so on. -- http://mail.python.org/mailman/listinfo/python-list
Re: making a python program in windows
Dave Angel da...@ieee.org wrote: Anyway, now you can see two batch files you could use to make a particular version of Python active. The first one uses assoc and ftype to fix the asssociations. And the other changes the environment variable PATHEXT to make the extension optional. Note that changing the environment variable is effective only for that DOS box, and its children. If you want a permanent change, you need to change the registry, probably at hklm\SYSTEM\ControlSet001\Contro/Session\Session Manager\Environment\PATHEXT The better way to do this is to bring up the System control panel applet (shortcut: WindowsKey + Pause/Break), Advanced, Environment Variables. In the System variables, click PATHEXT and Edit, and add ;.PY;.PYW to the end. -- Tim Roberts, t...@probo.com Providenza Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list