Re: Two Questions about Python on Windows

2014-04-05 Thread Tim Roberts
maxerick...@gmail.com wrote: > >You can also edit the PATHEXT environment variable to include .py/.pyw, >making the python source files executable (as long as the types are >properly registered with Windows; if double clicking runs them they >should be properly registered). Let me clarify that ju

Re: Two Questions about Python on Windows

2014-04-03 Thread Mark Lawrence
On 03/04/2014 23:41, Ian Kelly wrote: On Thu, Apr 3, 2014 at 2:15 PM, Mark Lawrence wrote: On 03/04/2014 18:54, Ian Kelly wrote: On Apr 3, 2014 11:12 AM, "Walter Hurry" mailto:walterhu...@gmail.com>> wrote: > > Normally my Python development is done on FreeBSD and Linux. I know that on *

Re: Two Questions about Python on Windows

2014-04-03 Thread Ian Kelly
On Thu, Apr 3, 2014 at 2:15 PM, Mark Lawrence wrote: > On 03/04/2014 18:54, Ian Kelly wrote: >> >> >> On Apr 3, 2014 11:12 AM, "Walter Hurry" > > wrote: >> > >> > Normally my Python development is done on FreeBSD and Linux. I know >> that on *ix I simply have to mak

Re: Two Questions about Python on Windows

2014-04-03 Thread Mark Lawrence
On 03/04/2014 18:54, Ian Kelly wrote: On Apr 3, 2014 11:12 AM, "Walter Hurry" mailto:walterhu...@gmail.com>> wrote: > > Normally my Python development is done on FreeBSD and Linux. I know that on *ix I simply have to make foo.py executable (the shebang line is present, of course) to make it ru

Re: Two Questions about Python on Windows

2014-04-03 Thread Ethan Furman
On 04/03/2014 10:54 AM, Ian Kelly wrote: On Apr 3, 2014 11:12 AM, "Walter Hurry" wrote: Secondly, on *ix, if there's an up-to-date .pyc in the right place and I run foo.py, Python will automagically use foo.pyc. I don't believe this is exactly correct. Python will only use a .pyc automatica

Re: Two Questions about Python on Windows

2014-04-03 Thread Terry Reedy
On 4/3/2014 1:06 PM, Walter Hurry wrote: Normally my Python development is done on FreeBSD and Linux. I know that on *ix I simply have to make foo.py executable (the shebang line is present, of course) to make it runnable. For my son's school assignment, I have to help him with Python for Wind

Re: Two Questions about Python on Windows

2014-04-03 Thread Ian Kelly
On Apr 3, 2014 11:12 AM, "Walter Hurry" wrote: > > Normally my Python development is done on FreeBSD and Linux. I know that on *ix I simply have to make foo.py executable (the shebang line is present, of course) to make it runnable. > > For my son's school assignment, I have to help him with Pytho

Re: Two Questions about Python on Windows

2014-04-03 Thread maxerickson
On Thursday, April 3, 2014 1:06:29 PM UTC-4, Walter Hurry wrote: > Normally my Python development is done on FreeBSD and Linux. I know that on > *ix I simply have to make foo.py executable (the shebang line is present, of > course) to make it runnable. > > For my son's school assignment, I have

Re: Two questions about logging

2012-01-15 Thread Vinay Sajip
On Jan 12, 2:19 am, Matthew Pounsett wrote: > First, I'd like to be able to permit users to do more typical log > rotation, based on their OS's log rotation handler, rather than > rotating logs from inside an application.  This is usually handled by > signalling an application with a HUP, whereup

Re: Two questions about logging

2012-01-14 Thread Matthew Pounsett
On Jan 12, 8:03 pm, K Richard Pixley wrote: > Here's the confusion.  Each log named __name__ is under the root logger. >   If you want them all, then catch them all with the root logger. Thanks! I knew I was missing something obvious. Between you and Jean- Michael Pichavant I've figured out wha

Re: Two questions about logging

2012-01-12 Thread K Richard Pixley
On 1/11/12 18:19 , Matthew Pounsett wrote: Second, I'm trying to get a handle on how libraries are meant to integrate with the applications that use them. The naming advice in the advanced tutorial is to use __name__ to name loggers, and to allow log messages to pass back up to the using applica

Re: Two questions about logging

2012-01-12 Thread Jean-Michel Pichavant
Matthew Pounsett wrote: [snip] Second, I'm trying to get a handle on how libraries are meant to integrate with the applications that use them. The naming advice in the advanced tutorial is to use __name__ to name loggers, and to allow log messages to pass back up to the using application's logg

Re: Two questions about logging

2012-01-11 Thread Matthew Pounsett
On Jan 11, 9:34 pm, Roy Smith wrote: > What I would do is log to syslog (logging.handlers.SysLogHandler) and > let syslog worry about rotating log files.  Why reinvent the wheel? Syslog is fine for an application run by an administrator, but isn't an option for a user. -- http://mail.python.org/

Re: Two questions about logging

2012-01-11 Thread Roy Smith
In article <7dabf43f-3814-47b6-966a-1439f5654...@i6g2000vbk.googlegroups.com>, Matthew Pounsett wrote: > First, I'd like to be able to permit users to do more typical log > rotation, based on their OS's log rotation handler, rather than > rotating logs from inside an application. This is usual

Re: Two questions ( Oracle and modules )

2009-12-07 Thread Terry Reedy
Gabor Urban wrote: Hi guys, 2. We have tp write a module that will be imported a couple of places. Though we must be sure, this module's initialization is performed only once. How can we implement this? I do not know what to google for. There are two ways to have one file executed twice

Re: Two questions ( Oracle and modules )

2009-12-07 Thread Michael Crute
On Mon, Dec 7, 2009 at 6:57 AM, Gabor Urban wrote: > 1. I have choice to introduce Python to my new employee. We are to > write and application that uses databases stored partially in Oracle > 10 and partially in Oracle 11. We have to execute standard SQL > commands and stored procedures as well.

Re: Two questions about style and some simple math

2009-01-20 Thread Rhodri James
On Tue, 20 Jan 2009 02:11:24 -, Mensanator wrote: On Jan 19, 7:44 pm, "Rhodri James" wrote: Surely in any case you don't want an expression based on the difference, since that would give you the same chance of having the first attack no matter what the levels of courage actually were, whi

Re: Two questions about style and some simple math

2009-01-20 Thread J Kenneth King
Spoofy writes: > .. .. > > 2. > > For maintaining the character attributes I creates a seperate class. I > wonder weather this is an "overuse" of OO (instead of just making the > attributes plain variables of the Char class) and if the way I wrote > this is OK (somehow this looks cool to me but

Re: Two questions about style and some simple math

2009-01-19 Thread John Machin
On Jan 20, 12:15 pm, Spoofy wrote: > Hello everybody! > > Though I'm a hobby programmer for years now (mainly small hackery > things) I still have big problems getting "real" things to work. > > I'm currently trying to write a simple RPG and have problems with > the following: > > 1. > > Character

Re: Two questions about style and some simple math

2009-01-19 Thread Mensanator
On Jan 19, 7:44 pm, "Rhodri James" wrote: > On Tue, 20 Jan 2009 01:15:47 -, Spoofy wrote: > > Hello everybody! > > > Though I'm a hobby programmer for years now (mainly small hackery   > > things) I still have big problems getting "real" things to work. > > > I'm currently trying to write a s

Re: Two questions about style and some simple math

2009-01-19 Thread MRAB
Spoofy wrote: Hello everybody! Though I'm a hobby programmer for years now (mainly small hackery things) I still have big problems getting "real" things to work. I'm currently trying to write a simple RPG and have problems with the following: 1. Characters have a "courage" attribute that

Re: Two questions about style and some simple math

2009-01-19 Thread Rhodri James
On Tue, 20 Jan 2009 01:15:47 -, Spoofy wrote: Hello everybody! Though I'm a hobby programmer for years now (mainly small hackery things) I still have big problems getting "real" things to work. I'm currently trying to write a simple RPG and have problems with the following: 1. Cha

Re: two questions about thread

2006-01-16 Thread Bryan Olson
Kevin wrote: > The best way to do this is by using a flag or event that the child-threads > monitor each loop (or multiple times per loop if it's a long loop). If the > flag is set, they exit themselves. > > The parent thread only has to set the flag to cause the children to die. Doesn't work, b

Re: two questions about thread

2006-01-15 Thread Kevin
The best way to do this is by using a flag or event that the child-threads monitor each loop (or multiple times per loop if it's a long loop). If the flag is set, they exit themselves. The parent thread only has to set the flag to cause the children to die. Kevin. "Bryan Olson" <[EMAIL PROTECT

Re: two questions about thread

2006-01-14 Thread Bryan Olson
iclinux wrote: > a. how to exit the whole process in a thread? > b. when thread doing a infinite loops, how to terminate the process?: As others noted, the threading module offers Thread.setDaemon. As the doc says: "The entire Python program exits when no active non-daemon threads are left." Py

Re: two questions about thread

2006-01-14 Thread Diez B. Roggisch
iclinux wrote: > hi there, > > I'm new to python, and have two questions: > > a. how to exit the whole process in a thread? sys.exit() Works only if Thread.setDaemon(True) is invoked on all threads. > b. when thread doing a infinite loops, how to terminate the process?: > it seems that th

Re: Two questions on PyDev for Eclipse

2005-09-20 Thread Fabio Zadrozny
Fabio Zadrozny wrote: >Hi, > >for 2: as far as I know, eclipse must have 'local', or at least >'emulated' local access, so, if you have samba access, it should do what >you want. > >for 1... I use it a LOT without any problems for some really big >projects ( with about 2.000 python modules -- n

Re: Two questions on PyDev for Eclipse

2005-09-20 Thread Fabio Zadrozny
Hi, for 2: as far as I know, eclipse must have 'local', or at least 'emulated' local access, so, if you have samba access, it should do what you want. for 1... I use it a LOT without any problems for some really big projects ( with about 2.000 python modules -- not counting the python install

Re: Two questions on lambda:

2005-06-24 Thread Terry Reedy
"Xavier Décoret" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I cannot find the way to do generic lambda functions using the lambda > syntax in python. I am probably missing a point. Thinking of lambda args: expression as more or less abbreviati

Re: Two questions on lambda:

2005-06-24 Thread Sean McIlroy
def PRINT(x): print x f = lambda: PRINT("hello") ### def let(x,y): globals()[x] = y return True f = lambda x: let('y',x*x) and y+y -- http://mail.python.org/mailman/listinfo/python-list

Re: Two questions on lambda:

2005-06-24 Thread Christophe Delord
hello, On Fri, 24 Jun 2005 14:48:16 +0200, Xavier Décoret wrote: > Hi, > > In the same spirit, how can I do to compute intermediary values in the > > body of a lambda function. Let's say (dummy example): > > f = lambda x : y=x*x,y+y > > > In languages like Caml, you can do: > > let f = func

Re: Two questions on lambda:

2005-06-24 Thread John Roth
"Xavier Décoret" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I cannot find the way to do generic lambda functions using the lambda > syntax in python. I am probably missing a point. You are. Lambda is restricted to a _single expression_. Your first example is a stateme

Re: Two questions on lambda:

2005-06-24 Thread Duncan Booth
Xavier Décoret wrote: > Is there a particular syntax for lambda that I am missing > or is it simply limited and I cannot do what I want with lambda. Lambda is deliberately limited. Just define a function. The only downside to defining a function is that you have to think of a name for it, but

Re: Two questions on lambda:

2005-06-24 Thread Kristian Zoerhoff
On 6/24/05, Xavier Décoret <[EMAIL PROTECTED]> wrote: > > For example, the code > > # f = lambda : print "hello" > # f() > does not compile, although: > > # def f(): > # print "hello" > # f() > > does compile. Is there a particular syntax for lambda that I am missing > or is it simply lim

Re: Two questions

2005-06-02 Thread Andrew Dalke
Steven D'Aprano wrote: > The existence of one or two or a thousand profitable software packages > out of the millions in existence does not invalidate my skepticism that > some random piece of software will directly make money for the > developer. 'Tis true. I think (but have no numbers to back m

Re: Two questions

2005-06-02 Thread Steven D'Aprano
Andrew Dalke wrote: > Steven D'Aprano wrote: > >>I can think of a number of reasons why somebody might want to hide their >>code. In no particular order: > > >>(3) You have create an incredibly valuable piece of code that will be >>worth millions, but only if nobody can see the source code. Ye

Re: Two questions

2005-06-02 Thread alex23
Sorry to continue with the thread hijack... Steven D'Aprano wrote: > (3) You have create an incredibly valuable piece of code that will be > worth millions, but only if nobody can see the source code. Yeah right. An interesting corollay that comes from source code transparency is that it generall

Re: Two questions

2005-06-02 Thread Andrew Dalke
Greg Ewing wrote: > Hmmm... if these are GPL weapons, if you want to fire > them at anyone you'll *have* to make them available to > all other countries as well... not good for > non-proliferation... I think the source code only needs to be sent to the country which receive the weapons. Include a

Re: Two questions

2005-06-02 Thread Greg Ewing
Andrew Dalke wrote: > You are the US government developing software to design/test the > next generation nuclear weapons system and don't want any other > country to use it. (GnuNuke?) Hmmm... if these are GPL weapons, if you want to fire them at anyone you'll *have* to make them available

Re: Two questions

2005-06-02 Thread Steven D'Aprano
John Machin wrote: >> In other words, to create your .pyc file, just run your .py file and >> Python will do it automatically. >> > > The notion that just running a .py file will create a .pyc file is > contrary to widely-held belief, and (admittedly small, but very recent, > on Python 2.4.1, i

Re: Two questions

2005-06-02 Thread Andrew Dalke
Steven D'Aprano wrote: > I can think of a number of reasons why somebody might want to hide their > code. In no particular order: > (3) You have create an incredibly valuable piece of code that will be > worth millions, but only if nobody can see the source code. Yeah right. - id software makes

Re: Two questions

2005-06-02 Thread John Machin
Steven D'Aprano wrote: > On Thu, 02 Jun 2005 06:45:18 -0700, qscomputing wrote: > >>2. Philospohy(sp?) aside, > > > Philosophy. > > >>I could potentially want to create a >>binary-only distribution of my finished apps. I noticed the >>documentation on .pyc files: how do I create these > >

Re: Two questions

2005-06-02 Thread John Machin
Peter Hansen wrote: > [EMAIL PROTECTED] wrote: > >> Thanks to you all for the quick response. >> >> I've noticed that when I do >> $ python myprog.py >> the file myprog.pyc file is not created, but the .pyc files for files I >> import *are* created. Is this intentional and, if so, how do I get the

Re: Two questions

2005-06-02 Thread qscomputing
> > 1. What is the easiest way to create a for loop in the style I'm used > > to from Delphi > > Use Delphi. Very literal interpretation of my text: I should have said "in a similar style to". :-) > I can think of a number of reasons why somebody might want to hide their > code. I can't really t

Re: Two questions

2005-06-02 Thread Peter Hansen
rbt wrote: > Peter Hansen wrote: >> Philosophy not entirely aside, you should note that object code in any >> language can "easily" be reverse-engineered in the same way, with the >> only difference being the degree of ease involved. If the code is >> worth enough to someone that they are willi

Re: Two questions

2005-06-02 Thread Steven D'Aprano
On Thu, 02 Jun 2005 06:45:18 -0700, qscomputing wrote: > Hi, > > I've developed in several other languages and have recently found > Python and I'm trying to use it in the shape of the PythonCard > application development tool. > > My two questions: > > 1. What is the easiest way to create a fo

Re: Two questions

2005-06-02 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > Thanks to you all for the quick response. > > I've noticed that when I do > $ python myprog.py > the file myprog.pyc file is not created, but the .pyc files for files I > import *are* created. Is this intentional and, if so, how do I get the > myprog.pyc file? I thought

Re: Two questions

2005-06-02 Thread qscomputing
Thanks to you all for the quick response. I've noticed that when I do $ python myprog.py the file myprog.pyc file is not created, but the .pyc files for files I import *are* created. Is this intentional and, if so, how do I get the myprog.pyc file? Thanks, - QS Computing. -- http://mail.pytho

Re: Two questions

2005-06-02 Thread Reinhold Birkenfeld
Richard Lewis wrote: > On 2 Jun 2005 06:45:18 -0700, [EMAIL PROTECTED] said: >> Hi, >> >> I've developed in several other languages and have recently found >> Python and I'm trying to use it in the shape of the PythonCard >> application development tool. >> >> My two questions: >> >> 1. What is

Re: Two questions

2005-06-02 Thread Diez B. Roggisch
rbt wrote: > Peter Hansen wrote: > >> Philosophy not entirely aside, you should note that object code in any >> language can "easily" be reverse-engineered in the same way, with the >> only difference being the degree of ease involved. If the code is >> worth enough to someone that they are wi

Re: Two questions

2005-06-02 Thread rbt
Peter Hansen wrote: > Philosophy not entirely aside, you should note that object code in any > language can "easily" be reverse-engineered in the same way, with the > only difference being the degree of ease involved. If the code is worth > enough to someone that they are willing to risk violat

Re: Two questions

2005-06-02 Thread Joal Heagney
[EMAIL PROTECTED] wrote: > Hi, > > I've developed in several other languages and have recently found > Python and I'm trying to use it in the shape of the PythonCard > application development tool. > > My two questions: > > 1. What is the easiest way to create a for loop in the style I'm used >

Re: Two questions

2005-06-02 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > I've developed in several other languages and have recently found > Python and I'm trying to use it in the shape of the PythonCard > application development tool. > > My two questions: > > 1. What is the easiest way to create a for loop in the style I'm used > to from D

Re: Two questions

2005-06-02 Thread Richard Lewis
On 2 Jun 2005 06:45:18 -0700, [EMAIL PROTECTED] said: > Hi, > > I've developed in several other languages and have recently found > Python and I'm trying to use it in the shape of the PythonCard > application development tool. > > My two questions: > > 1. What is the easiest way to create a for

RE: two questions - no common theme

2005-02-14 Thread Batista, Facundo
Title: RE: two questions - no common theme [EMAIL PROTECTED] #- Any help will be greatly appreciated. It's always better to address two different questions in two different mails, with appropiate subjects. .    Facundo Bitácora De Vuelo: http://www.taniquetil.com.ar/plog PyAr - P

RE: two questions - no common theme

2005-02-09 Thread Harper, Gina
2) os.listdir "returns a list containing the names of the entries in the directory", this does include directories in the top level directory. For the complete listing try os.walk() which "returns a tuple-(dirpath, dirnames, filenames" -Original Message- From: Sean McIlroy [mailto:[EMAIL

Re: two questions - no common theme

2005-02-09 Thread Larry Bates
...how do I get hold of a list of its subdirectories? This does what you asked for: import os targetpath='c:\\' all=os.listdir(targetpath) subdirs=[x for x in all if os.path.isdir(os.path.join(targetpath, x))] But you may need to take a look at os.walk (as others have suggested) also. Larr

Re: two questions - no common theme

2005-02-09 Thread Fredrik Lundh
Sean McIlroy wrote: > 1) I'd like to be able to bind callbacks to presses of the arrow > buttons on the keyboard. How do you say that in Tkinter? , , , http://effbot.org/books/tkinterbook/events-and-bindings.htm For an ordinary 102-key PC-style keyboard, the special keys are Cancel (th

Re: two questions - no common theme

2005-02-09 Thread suryaprakashg
def walktree(self,top=".", depthfirst=False): """ Walk a directory tree, starting from 'top' This code is based on os.path.walk, with the callback function replaced by a yield and recursion replaced by iteration """ if type(top) != types.StringType:

Re: two questions - no common theme

2005-02-09 Thread [EMAIL PROTECTED]
os.walk gives an object with all files in a tree, e.g. f = os.walk('c:\\temp') for i in f: print i -- http://mail.python.org/mailman/listinfo/python-list