Re: How to check whether audio bytes contain empty noise or actual voice/signal?

2024-10-28 Thread Lars Liedtke via Python-list
There are also the concepts of Cepstrum (https://en.wikipedia.org/wiki/Cepstrum) and Quefrency, which are derivatives of Spectrum and Frequency, with which you can even do speaker-recognition, but also detection of events. Lars Liedtke Lead Developer [Tel.] +49 721 98993- [Fax] +49 721 98

Re: How to check whether audio bytes contain empty noise or actual voice/signal?

2024-10-26 Thread Thomas Passin via Python-list
On 10/25/2024 12:25 PM, marc nicole via Python-list wrote: Hello Python fellows, I hope this question is not very far from the main topic of this list, but I have a hard time finding a way to check whether audio data samples are containing empty noise or actual significant voice/noise. I am usi

Re: How to check whether audio bytes contain empty noise or actual voice/signal?

2024-10-26 Thread MRAB via Python-list
On 2024-10-25 17:25, marc nicole via Python-list wrote: Hello Python fellows, I hope this question is not very far from the main topic of this list, but I have a hard time finding a way to check whether audio data samples are containing empty noise or actual significant voice/noise. I am using

How to check whether audio bytes contain empty noise or actual voice/signal?

2024-10-25 Thread marc nicole via Python-list
Hello Python fellows, I hope this question is not very far from the main topic of this list, but I have a hard time finding a way to check whether audio data samples are containing empty noise or actual significant voice/noise. I am using PyAudio to collect the sound through my PC mic as follows:

How to check whether lip movement is significant using face landmarks in dlib?

2024-10-05 Thread marc nicole via Python-list
I am trying to assess whether the lips of a person are moving too much while the mouth is closed (to conclude they are chewing). I try to assess the lip movement through landmarks (dlib) : Inspired by the mouth example ( https://github.com/mauckc/mouth-open/blob/master/detect_open_mouth.py#L17),

Re: How to check if an image contains an element I am searchig for

2021-06-17 Thread Arak Rachael
On Thursday, 17 June 2021 at 09:59:49 UTC+2, Arak Rachael wrote: > On Thursday, 17 June 2021 at 08:52:55 UTC+2, Peter J. Holzer wrote: > > On 2021-06-16 15:51:49 -0700, Arak Rachael wrote: > > > On Wednesday, 16 June 2021 at 23:44:02 UTC+2, Chris Angelico wrote: > > > > On Thu, Jun 17, 2021 at 7

Re: How to check if an image contains an element I am searchig for

2021-06-17 Thread Arak Rachael
On Thursday, 17 June 2021 at 08:52:55 UTC+2, Peter J. Holzer wrote: > On 2021-06-16 15:51:49 -0700, Arak Rachael wrote: > > On Wednesday, 16 June 2021 at 23:44:02 UTC+2, Chris Angelico wrote: > > > On Thu, Jun 17, 2021 at 7:35 AM Dan Stromberg wrote: > > > > > > > > On Wed, Jun 16, 2021 at 2:0

Re: How to check if an image contains an element I am searchig for

2021-06-16 Thread Peter J. Holzer
On 2021-06-16 15:51:49 -0700, Arak Rachael wrote: > On Wednesday, 16 June 2021 at 23:44:02 UTC+2, Chris Angelico wrote: > > On Thu, Jun 17, 2021 at 7:35 AM Dan Stromberg wrote: > > > > > > On Wed, Jun 16, 2021 at 2:04 PM Barry wrote: > > > > > > > >>> On Thu, Jun 17, 2021 at 6:06 AM Arak Racha

Re: How to check if an image contains an element I am searchig for

2021-06-16 Thread Chris Angelico
On Thu, Jun 17, 2021 at 4:43 PM Dan Stromberg wrote: > > > > On Wed, Jun 16, 2021 at 2:44 PM Chris Angelico wrote: >> >> On Thu, Jun 17, 2021 at 7:35 AM Dan Stromberg wrote: >> > > >> How well can you define the things you're looking for? >> > > >> >> > > >> https://xkcd.com/1425/ >> > > >> >> >

Re: How to check if an image contains an element I am searchig for

2021-06-16 Thread Dan Stromberg
On Wed, Jun 16, 2021 at 2:44 PM Chris Angelico wrote: > On Thu, Jun 17, 2021 at 7:35 AM Dan Stromberg wrote: > > > >> How well can you define the things you're looking for? > > > >> > > > >> https://xkcd.com/1425/ > > > >> > > > > He means that image processing is a hard problem that requires >

Re: How to check if an image contains an element I am searchig for

2021-06-16 Thread Cameron Simpson
On 16Jun2021 15:51, Arak Rachael wrote: >I understand your concerns. Actually I am doing image processing of >satellite pictures for smart cars. I have been given the option to use >InfranView and do it manually or create a Python script. If you need to slice images into 100x100 pixels squares,

Re: How to check if an image contains an element I am searchig for

2021-06-16 Thread Arak Rachael
On Wednesday, 16 June 2021 at 23:44:02 UTC+2, Chris Angelico wrote: > On Thu, Jun 17, 2021 at 7:35 AM Dan Stromberg wrote: > > > > On Wed, Jun 16, 2021 at 2:04 PM Barry wrote: > > > > > >>> On Thu, Jun 17, 2021 at 6:06 AM Arak Rachael > > > wrote: > > > >>> > > > >>> Hi guys, > > > >>> >

Re: How to check if an image contains an element I am searchig for

2021-06-16 Thread Chris Angelico
On Thu, Jun 17, 2021 at 7:35 AM Dan Stromberg wrote: > > On Wed, Jun 16, 2021 at 2:04 PM Barry wrote: > > > >>> On Thu, Jun 17, 2021 at 6:06 AM Arak Rachael > > wrote: > > >>> > > >>> Hi guys, > > >>> > > >>> I have an image from google maps to say and I need to check if it has > > road markings

Re: How to check if an image contains an element I am searchig for

2021-06-16 Thread Dan Stromberg
On Wed, Jun 16, 2021 at 2:04 PM Barry wrote: > >>> On Thu, Jun 17, 2021 at 6:06 AM Arak Rachael > wrote: > >>> > >>> Hi guys, > >>> > >>> I have an image from google maps to say and I need to check if it has > road markings, in order to do that, I believe I need to change the effects > on the im

Re: How to check if an image contains an element I am searchig for

2021-06-16 Thread Chris Angelico
On Thu, Jun 17, 2021 at 7:25 AM Dennis Lee Bieber wrote: > > On Thu, 17 Jun 2021 06:07:59 +1000, Chris Angelico > declaimed the following: > > > >How well can you define the things you're looking for? > > > >https://xkcd.com/1425/ > > Non sequitur comment -- Sounds like a potential usage

Re: How to check if an image contains an element I am searchig for

2021-06-16 Thread Barry
> On 16 Jun 2021, at 21:46, Arak Rachael wrote: > > On Wednesday, 16 June 2021 at 22:08:31 UTC+2, Chris Angelico wrote: >>> On Thu, Jun 17, 2021 at 6:06 AM Arak Rachael wrote: >>> >>> Hi guys, >>> >>> I have an image from google maps to say and I need to check if it has road >>> markings

Re: How to check if an image contains an element I am searchig for

2021-06-16 Thread Chris Angelico
On Thu, Jun 17, 2021 at 6:44 AM Arak Rachael wrote: > > On Wednesday, 16 June 2021 at 22:08:31 UTC+2, Chris Angelico wrote: > > On Thu, Jun 17, 2021 at 6:06 AM Arak Rachael wrote: > > > > > > Hi guys, > > > > > > I have an image from google maps to say and I need to check if it has > > > road ma

Re: How to check if an image contains an element I am searchig for

2021-06-16 Thread Arak Rachael
On Wednesday, 16 June 2021 at 22:08:31 UTC+2, Chris Angelico wrote: > On Thu, Jun 17, 2021 at 6:06 AM Arak Rachael wrote: > > > > Hi guys, > > > > I have an image from google maps to say and I need to check if it has road > > markings, in order to do that, I believe I need to change the effec

Re: How to check if an image contains an element I am searchig for

2021-06-16 Thread Chris Angelico
On Thu, Jun 17, 2021 at 6:06 AM Arak Rachael wrote: > > Hi guys, > > I have an image from google maps to say and I need to check if it has road > markings, in order to do that, I believe I need to change the effects on the > image so the markings and road can be white or something and the things

How to check if an image contains an element I am searchig for

2021-06-16 Thread Arak Rachael
Hi guys, I have an image from google maps to say and I need to check if it has road markings, in order to do that, I believe I need to change the effects on the image so the markings and road can be white or something and the things I don't need like cars, trees and so on to be black. images s

Re: I have no clue figuring out how to check dates in workholidays

2020-11-06 Thread Cameron Simpson
On 06Nov2020 08:41, J.J. E. wrote: >Thank you for allowing me in this support mailing list. Anyone may join. Welcome! >My experience with >Python is short due to my new job. My boss told me that I need to create a >code that checks yesterday's date. The conditions for returning none are >that: >

I have no clue figuring out how to check dates in workholidays

2020-11-06 Thread J.J. E.
Hi, Thank you for allowing me in this support mailing list. My experience with Python is short due to my new job. My boss told me that I need to create a code that checks yesterday's date. The conditions for returning none are that: - Yesterday happens to be a holiday, - Yesterday turns out

Re: How to check in script if Python or Jython is used

2015-06-22 Thread Dan Stromberg
IMO, it's usually better to test for features and use them if they are present, than to build a list of features available in specific interpreters. I see it as analogous to the difference between huge C #ifdef's on OS, and autoconf. On Sun, Jun 21, 2015 at 1:12 AM, Cecil Westerhof wrote: > I in

Re: How to check in script if Python or Jython is used

2015-06-21 Thread Thomas 'PointedEars' Lahn
Cecil Westerhof wrote: > I installed Jython and will start playing with it. There probably will > be differences between Python and Jython. Is there a way to determine > if a script is run by Python or Jython? Then different execution paths > could be taken. With sys.version(_info) you do not get

Re: How to check in script if Python or Jython is used

2015-06-21 Thread Albert-Jan Roskam via Python-list
Sun, Jun 21, 2015 12:24 PM CEST Cecil Westerhof wrote: >On Sunday 21 Jun 2015 11:22 CEST, Laura Creighton wrote: > >> In a message of Sun, 21 Jun 2015 10:12:06 +0200, Cecil Westerhof >> writes: >> I installed Jython and will start playing with it. There probably >> will

Re: How to check in script if Python or Jython is used

2015-06-21 Thread Cecil Westerhof
On Sunday 21 Jun 2015 11:22 CEST, Laura Creighton wrote: > In a message of Sun, 21 Jun 2015 10:12:06 +0200, Cecil Westerhof > writes: >> I installed Jython and will start playing with it. There probably >> will be differences between Python and Jython. Is there a way to >> determine if a script is

Re: How to check in script if Python or Jython is used

2015-06-21 Thread Laura Creighton
In a message of Sun, 21 Jun 2015 10:12:06 +0200, Cecil Westerhof writes: >I installed Jython and will start playing with it. There probably will >be differences between Python and Jython. Is there a way to determine >if a script is run by Python or Jython? Then different execution paths >could be t

How to check in script if Python or Jython is used

2015-06-21 Thread Cecil Westerhof
I installed Jython and will start playing with it. There probably will be differences between Python and Jython. Is there a way to determine if a script is run by Python or Jython? Then different execution paths could be taken. With sys.version(_info) you do not get this information. -- Cecil Wes

Re: how to check if a value is a floating point or not

2014-06-20 Thread Ian Kelly
On Fri, Jun 20, 2014 at 8:28 AM, Grant Edwards wrote: > On 2014-06-20, Mark Lawrence wrote: > >> For the OP a very important rule of thumb is never use a bare except, so >> this is right out. >> >> try: >> doSomething() >> except: >> WTF() > > IMO, that sort of depends on WTF() does. On

Re: how to check if a value is a floating point or not

2014-06-20 Thread alister
On Fri, 20 Jun 2014 14:28:52 +, Grant Edwards wrote: > On 2014-06-20, Mark Lawrence wrote: > >> For the OP a very important rule of thumb is never use a bare except, >> so this is right out. >> >> try: >> doSomething() >> except: >> WTF() > > IMO, that sort of depends on WTF() doe

Re: how to check if a value is a floating point or not

2014-06-20 Thread Grant Edwards
On 2014-06-20, Mark Lawrence wrote: > For the OP a very important rule of thumb is never use a bare except, so > this is right out. > > try: > doSomething() > except: > WTF() IMO, that sort of depends on WTF() does. One case where a bare except is well used is when stdandard output/er

Re: how to check if a value is a floating point or not

2014-06-20 Thread Mark Lawrence
On 20/06/2014 14:16, Sturla Molden wrote: Nicholas Cannon wrote: Guys i am only a beginner at python most of the stuff you are saying i need to do i dont understand. Then listen and try to learn :-) But don't use try/except everywhere! Some exceptions might be due to an error in your own co

Re: how to check if a value is a floating point or not

2014-06-20 Thread Sturla Molden
Nicholas Cannon wrote: > Guys i am only a beginner at python most of the stuff you are saying i > need to do i dont understand. Then listen and try to learn :-) In C it is customary to do all sorts of sanity checks in advance. Validating user input is an example. We can call this "to ask permis

Re: how to check if a value is a floating point or not

2014-06-19 Thread Ian Kelly
On Fri, Jun 20, 2014 at 12:14 AM, Nicholas Cannon wrote: > Guys i am only a beginner at python most of the stuff you are saying i need > to do i dont understand. All we're saying is that the simplest and most accurate way to determine whether a string can be converted to an int or a float is to

Re: how to check if a value is a floating point or not

2014-06-19 Thread Nicholas Cannon
Guys i am only a beginner at python most of the stuff you are saying i need to do i dont understand. -- https://mail.python.org/mailman/listinfo/python-list

Re: how to check if a value is a floating point or not

2014-06-19 Thread Sturla Molden
wrote: > I am making a calculator and i need it to support floating point values > but i am using the function isnumeric to check if the user has entered an > int value. I need the same for floating point types so i could implement > an or in the if statement that checks the values the user has en

Re: how to check if a value is a floating point or not

2014-06-19 Thread Ian Kelly
On Thu, Jun 19, 2014 at 1:23 AM, Ian Kelly wrote: > On Thu, Jun 19, 2014 at 12:48 AM, Nicholas Cannon > wrote: >> On Thursday, June 19, 2014 1:53:31 PM UTC+8, Nicholas Cannon wrote: >>> I am making a calculator and i need it to support floating point values but >>> i am using the function isnume

Re: how to check if a value is a floating point or not

2014-06-19 Thread Ian Kelly
On Thu, Jun 19, 2014 at 12:48 AM, Nicholas Cannon wrote: > On Thursday, June 19, 2014 1:53:31 PM UTC+8, Nicholas Cannon wrote: >> I am making a calculator and i need it to support floating point values but >> i am using the function isnumeric to check if the user has entered an int >> value. I n

Re: how to check if a value is a floating point or not

2014-06-19 Thread Ben Finney
Nicholas Cannon writes: > #checks if the user input is an integer value > def checkint(a): > if a.isnumeric(): > return True > else: > if a.isalpha(): > return False > else: > return True What code

Re: how to check if a value is a floating point or not

2014-06-18 Thread Nicholas Cannon
On Thursday, June 19, 2014 1:53:31 PM UTC+8, Nicholas Cannon wrote: > I am making a calculator and i need it to support floating point values but i > am using the function isnumeric to check if the user has entered an int > value. I need the same for floating point types so i could implement an o

Re: how to check if a value is a floating point or not

2014-06-18 Thread Gary Herron
On 06/18/2014 10:53 PM, nicholascann...@gmail.com wrote: I am making a calculator and i need it to support floating point values but i am using the function isnumeric to check if the user has entered an int value. I need the same for floating point types so i could implement an or in the if st

how to check if a value is a floating point or not

2014-06-18 Thread nicholascannon1
I am making a calculator and i need it to support floating point values but i am using the function isnumeric to check if the user has entered an int value. I need the same for floating point types so i could implement an or in the if statement that checks the values the user has entered and all

Re: How to check the date validity?

2013-12-25 Thread Chris Angelico
On Thu, Dec 26, 2013 at 6:03 AM, Sibylle Koczian wrote: > MySQL used to accept wrong date and datetime formats without error messages. > Garbage in the database, because validation was (is?) considered the job of > "the application". Possibly that has changed, but I'd look into the docs. It > isn'

Re: How to check the date validity?

2013-12-25 Thread Sibylle Koczian
Am 24.12.2013 01:39, schrieb Chris Angelico: On Tue, Dec 24, 2013 at 11:30 AM, Igor Korot wrote: So, my question is: since there is a simple way of inserting preformatted string into the datetime field of mySQL, how do I validate the date string? Well, the easiest way would be to simply attem

Re: How to check the date validity?

2013-12-24 Thread gregor
Am Mon, 23 Dec 2013 16:30:35 -0800 schrieb Igor Korot : > > Now, it looks that the python way of validating the date/time of the > string is to call strptime(). However looking at the docs and trying > to use the function I didn't find a way to check for the milliseconds. > Now the dates can be f

Re: How to check the date validity?

2013-12-23 Thread Andreas Perstinger
Jason Friedman wrote: >Would this not work? >import re >if re.search(r"\d{1,2}:\d{2}:\d{2}(.\d{1,3})?", "12:55:55.705"): ># It's a time No, because this regexp also matches stuff like "99:99:99.999". Checking for the number of digits is not enough, because not all combinations of two digits a

Re: How to check the date validity?

2013-12-23 Thread Jason Friedman
> In this file I have 3 different kind of fields: one consist of the > sole date, one - sole time and one - datetime. The time includes > milliseconds, i.e. "12:55:55.705" > All fields of the file including those 3 I am reading as the string. > All those strings after validating will go into mySQL

Re: How to check the date validity?

2013-12-23 Thread Mark Lawrence
On 24/12/2013 00:30, Igor Korot wrote: Hi, ALL, I'm working on the python script which reads the data from the csv file. In this file I have 3 different kind of fields: one consist of the sole date, one - sole time and one - datetime. The time includes milliseconds, i.e. "12:55:55.705" All fields

Re: How to check the date validity?

2013-12-23 Thread Chris Angelico
On Tue, Dec 24, 2013 at 11:30 AM, Igor Korot wrote: > So, my question is: since there is a simple way of inserting > preformatted string into the datetime field of mySQL, how do I > validate the date string? Well, the easiest way would be to simply attempt the SQL query. If it comes back with an

How to check the date validity?

2013-12-23 Thread Igor Korot
Hi, ALL, I'm working on the python script which reads the data from the csv file. In this file I have 3 different kind of fields: one consist of the sole date, one - sole time and one - datetime. The time includes milliseconds, i.e. "12:55:55.705" All fields of the file including those 3 I am readi

Re: How to check client shutdown?

2013-08-27 Thread Irmen de Jong
On 27-8-2013 22:40, Chris Angelico wrote: > Right. When you use TCP sockets, there's no boundaries, so you could > get two pickles in one recv, or you could get one and a half, or > anything. It depends partly on your buffer sizes and things; if you're > sending very short messages (less than a k

Re: How to check client shutdown?

2013-08-27 Thread Chris Angelico
On Wed, Aug 28, 2013 at 6:22 AM, Irmen de Jong wrote: > ? What is the actual downside of having >> the server set to anticipate a message length which is known to be more than >> will be >> sent (or be allowed to be sent?), for example connection.recv(1). Does >> not the >> receiver know the

Re: How to check client shutdown?

2013-08-27 Thread Irmen de Jong
On 27-8-2013 19:44, Paul Pittlerson wrote: >> MAJOR security issue here. You are taking data from a networked source >> >> and running it through a trusting system (pickle). This is NOT >> >> recommended. >> > > Security issue!? Do you mean someone could enter devious python h4xx into the > ch

Re: How to check client shutdown?

2013-08-27 Thread Andrew Berg
On 2013.08.27 12:44, Paul Pittlerson wrote: > Security issue!? Do you mean someone could enter devious python h4xx into the > chat or something? I had no idea using pickle was so dangerous, but I don't > know any other method of transmitting data in python :( JSON, XML, or any other format that d

Re: How to check client shutdown?

2013-08-27 Thread Paul Pittlerson
> MAJOR security issue here. You are taking data from a networked source > > and running it through a trusting system (pickle). This is NOT > > recommended. > Security issue!? Do you mean someone could enter devious python h4xx into the chat or something? I had no idea using pickle was so dang

Re: How to check client shutdown?

2013-08-26 Thread Grant Edwards
On 2013-08-26, Paul Pittlerson wrote: > I'm currently learning about the socket module. My question is how > can I detect if a connection is closed from the other side, recv() will return an empty value of ''. send() will eventually throw an exception. [You may be able to call send() once or t

Re: How to check client shutdown?

2013-08-26 Thread MRAB
On 26/08/2013 20:45, Paul Pittlerson wrote: I'm currently learning about the socket module. My question is how can I detect if a connection is closed from the other side, for example a KeyboardInterrupt as I frequently use. My code below: [snip] When reading from a socket, it'll return as much

Re: How to check client shutdown?

2013-08-26 Thread Chris Angelico
On Tue, Aug 27, 2013 at 5:45 AM, Paul Pittlerson wrote: > I'm currently learning about the socket module. My question is how can I > detect if a connection is closed from the other side, for example a > KeyboardInterrupt as I frequently use. My code below: > Once the remote end has terminated (

How to check client shutdown?

2013-08-26 Thread Paul Pittlerson
I'm currently learning about the socket module. My question is how can I detect if a connection is closed from the other side, for example a KeyboardInterrupt as I frequently use. My code below: ## #server script: class client(threading.Th

Re: How to check for threads being finished?

2013-07-06 Thread Stefan Behnel
Irmen de Jong, 05.07.2013 19:12: > On 5-7-2013 18:59, Steven D'Aprano wrote: >> I then block until the threads are all done: >> >> while any(t.isAlive() for t in threads): >> pass >> >> >> Is that the right way to wait for the threads to be done? Should I stick >> a call to time.sleep() inside

Re: How to check for threads being finished?

2013-07-05 Thread Steven D'Aprano
On Fri, 05 Jul 2013 19:12:44 +0200, Irmen de Jong wrote: > On 5-7-2013 18:59, Steven D'Aprano wrote: >> I then block until the threads are all done: >> >> while any(t.isAlive() for t in threads): >> pass >> >> >> Is that the right way to wait for the threads to be done? Should I >> stick a

Re: How to check for threads being finished?

2013-07-05 Thread Cameron Simpson
On 05Jul2013 16:59, Steven D'Aprano wrote: | I have a pool of worker threads, created like this: | | threads = [MyThread(*args) for i in range(numthreads)] | for t in threads: | t.start() | | I then block until the threads are all done: | | while any(t.isAlive() for t in threads): | pa

Re: How to check for threads being finished?

2013-07-05 Thread Ian Kelly
On Fri, Jul 5, 2013 at 10:59 AM, Steven D'Aprano wrote: > I have a pool of worker threads, created like this: > > threads = [MyThread(*args) for i in range(numthreads)] > for t in threads: > t.start() > > > I then block until the threads are all done: > > while any(t.isAlive() for t in threads

Re: How to check for threads being finished?

2013-07-05 Thread Irmen de Jong
On 5-7-2013 18:59, Steven D'Aprano wrote: > I then block until the threads are all done: > > while any(t.isAlive() for t in threads): > pass > > > Is that the right way to wait for the threads to be done? Should I stick > a call to time.sleep() inside the while loop? If so, how long should

Re: How to check for threads being finished?

2013-07-05 Thread Chris Angelico
On Sat, Jul 6, 2013 at 2:59 AM, Steven D'Aprano wrote: > I then block until the threads are all done: > > while any(t.isAlive() for t in threads): > pass > Using the threading module, I assume. Is there any reason you can't simply join() each thread in succession? ChrisA -- http://mail.pyth

How to check for threads being finished?

2013-07-05 Thread Steven D'Aprano
I have a pool of worker threads, created like this: threads = [MyThread(*args) for i in range(numthreads)] for t in threads: t.start() I then block until the threads are all done: while any(t.isAlive() for t in threads): pass Is that the right way to wait for the threads to be done? S

Re: How to check if Pexpect child already exist?

2012-12-05 Thread Dave Angel
On 12/05/2012 02:41 AM, Thomas Elsgaard wrote: > Hi List > > I am wondering, how can i check if child already exist before i spawn > ? By definition, before you call the spawn, the child doesn't exist. So presumably you must mean something else. > child.isalive() cannot be done on child before

How to check if Pexpect child already exist?

2012-12-04 Thread Thomas Elsgaard
Hi List I am wondering, how can i check if child already exist before i spawn ? child.isalive() cannot be done on child before it has been spawned. --- import pexpect child=pexpect.spawn('ssh mysurface@192.168.1.105') child.sendline('test') --- Thomas -- http://mail.python.org/mailman/listinfo

Re: How to check for single character change in a string?

2011-12-26 Thread tinnews
Roy Smith wrote: > In article , > Roy Smith wrote: > > > >>> len([x for x in zip(s1, s2) if x[0] != x[1]]) > > Heh, Ian Kelly's version: > > > sum(a == b for a, b in zip(str1, str2)) > > is cleaner than mine. Except that Ian's counts matches and the OP asked > for non-matches, but that's a

Re: How to check for single character change in a string?

2011-12-24 Thread Rick Johnson
On Dec 24, 11:09 am, Arnaud Delobelle wrote: > sum(map(str.__ne__, str1, str2)) Mirror, mirror, on the wall. Who's the cleanest of them all? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to check for single character change in a string?

2011-12-24 Thread Arnaud Delobelle
On 24 December 2011 16:10, Roy Smith wrote: > In article , >  Roy Smith wrote: > >> >>> len([x for x in zip(s1, s2) if x[0] != x[1]]) > > Heh, Ian Kelly's version: > >> sum(a == b for a, b in zip(str1, str2)) > > is cleaner than mine.  Except that Ian's counts matches and the OP asked > for non-m

Re: How to check for single character change in a string?

2011-12-24 Thread Roy Smith
In article , Roy Smith wrote: > >>> len([x for x in zip(s1, s2) if x[0] != x[1]]) Heh, Ian Kelly's version: > sum(a == b for a, b in zip(str1, str2)) is cleaner than mine. Except that Ian's counts matches and the OP asked for non-matches, but that's an exercise for the reader :-) -- http:/

Re: How to check for single character change in a string?

2011-12-24 Thread Roy Smith
In article , tinn...@isbd.co.uk wrote: > Can anyone suggest a simple/easy way to count how many characters have > changed in a string? Depending on exactly how you define "changed", you're probably talking about either Hamming Distance or Levenshtein Distance. I would start with the wikipedia

Re: How to check for single character change in a string?

2011-12-24 Thread Ian Kelly
On Sat, Dec 24, 2011 at 8:26 AM, wrote: > Can anyone suggest a simple/easy way to count how many characters have > changed in a string? > > E.g. giving results as follows:- > >    abcdefg     abcdefh         1 >    abcdefg     abcdekk         2 >    abcdefg     gfedcba         6 > > > Note that p

How to check for single character change in a string?

2011-12-24 Thread tinnews
Can anyone suggest a simple/easy way to count how many characters have changed in a string? E.g. giving results as follows:- abcdefg abcdefh 1 abcdefg abcdekk 2 abcdefg gfedcba 6 Note that position is significant, a character in a different positi

Re: How to Check Write Access of a Folder on Windows

2011-08-17 Thread Tim Golden
On 16/08/2011 13:38, Ayaskant Swain wrote: Hi Tim, Thanks for your reply. It seems this issue is related to python bug -http://bugs.python.org/issue2528 But the patch code looks complex to me. I want to make changes only in my python script which will read an user given directory path& check it'

Re: How to Check Write Access of a Folder on Windows

2011-08-16 Thread Ayaskant Swain
Hi Tim, Thanks for your reply. It seems this issue is related to python bug - http://bugs.python.org/issue2528 But the patch code looks complex to me. I want to make changes only in my python script which will read an user given directory path & check it's write access. What is the use of posixmo

Re: How to Check Write Access of a Folder on Windows

2011-08-12 Thread Tim Golden
On 12/08/2011 11:41, Ayaskanta Swain wrote: Hi, I have a requirement where I need to check the write permissions on a directory on Windows platform. I don’t want to use the python function os.access( ), since it does not work correctly on Windows. It is giving incorrect results to me. Another o

RE: How to Check Write Access of a Folder on Windows

2011-08-12 Thread Ayaskanta Swain
Some additional information - I am using python 2.5.1 version & it cannot be upgraded now to a higher version. Thanks Ayaskant- From: Ayaskanta Swain Sent: Friday, August 12, 2011 4:11 PM To: 'python-list@python.org' Subject: How to Check Wri

How to Check Write Access of a Folder on Windows

2011-08-12 Thread Ayaskanta Swain
Hi, I have a requirement where I need to check the write permissions on a directory on Windows platform. I don't want to use the python function os.access( ), since it does not work correctly on Windows. It is giving incorrect results to me. Another option of actually creating a temporary f

Re: How to check what is holding reference to object

2010-05-05 Thread Marius Gedminas
On Apr 27, 11:45 pm, Michal M wrote: > I've just found out that one of objects is not destroyed when it > should be. This means that something was holding reference to this > object or part of it (i.e. method). Is there any way to check what > holds that reference? I am unable to do that just look

Re: How to check what is holding reference to object

2010-05-05 Thread Marius Gedminas
On Apr 28, 3:59 pm, Christian Heimes wrote: > The trick works only for objects that are tracked by CPython's garbage > collector. Simple and non-containerish objects like str, int, unicode > and some other types aren't tracked by the gc. Yes they are -- have you ever tried >>> import gc >>>

Re: How to check when OCRing is finished

2010-05-03 Thread Chris Rebert
On Mon, May 3, 2010 at 8:44 AM, varnikat t wrote: > Hi, > How to check if OCR engine  like cuneiform,ocropus,ocrad OCRing an image has > completed the job if running it from a  python program? > > I am using a progress bar on the front end to show the OCRing progress > happening

How to check when OCRing is finished

2010-05-03 Thread varnikat t
Hi, How to check if OCR engine like cuneiform,ocropus,ocrad OCRing an image has completed the job if running it from a python program? I am using a progress bar on the front end to show the OCRing progress happening in background but how to stop progress bar automatically when OCRing is done

Re: How to check what is holding reference to object

2010-04-28 Thread Christian Heimes
Almar Klein wrote: Ah, it does exist! I wish I knew that two months ago, it would've saved me some precious time ;) The trick works only for objects that are tracked by CPython's garbage collector. Simple and non-containerish objects like str, int, unicode and some other types aren't tracked

Re: How to check what is holding reference to object

2010-04-28 Thread Almar Klein
On 27 April 2010 23:08, Chris Rebert wrote: > On Tue, Apr 27, 2010 at 1:45 PM, Michal M > wrote: > > I've just found out that one of objects is not destroyed when it > > should be. This means that something was holding reference to this > > object or part of it (i.e. method). Is there any way to

Re: How to check what is holding reference to object

2010-04-28 Thread Michal M
On Apr 28, 12:02 am, Chris Rebert wrote: > On Tue, Apr 27, 2010 at 2:58 PM, Chris Rebert wrote: > > On Tue, Apr 27, 2010 at 2:42 PM, Michal M > > wrote: > >> On 27 Kwi, 23:21, Duncan Booth wrote: > >>> Michal M wrote: > >>> > I've just found out that one of objects is not destroyed when it >

Re: How to check what is holding reference to object

2010-04-27 Thread Chris Rebert
On Tue, Apr 27, 2010 at 2:58 PM, Chris Rebert wrote: > On Tue, Apr 27, 2010 at 2:42 PM, Michal M wrote: >> On 27 Kwi, 23:21, Duncan Booth wrote: >>> Michal M wrote: >>> > I've just found out that one of objects is not destroyed when it >>> > should be. This means that something was holding refe

Re: How to check what is holding reference to object

2010-04-27 Thread Chris Rebert
On Tue, Apr 27, 2010 at 2:42 PM, Michal M wrote: > On 27 Kwi, 23:21, Duncan Booth wrote: >> Michal M wrote: >> > I've just found out that one of objects is not destroyed when it >> > should be. This means that something was holding reference to this >> > object or part of it (i.e. method). Is th

Re: How to check what is holding reference to object

2010-04-27 Thread Michal M
On 27 Kwi, 23:21, Duncan Booth wrote: > Michal M wrote: > > Hi > > > I've just found out that one of objects is not destroyed when it > > should be. This means that something was holding reference to this > > object or part of it (i.e. method). Is there any way to check what > > holds that refere

Re: How to check what is holding reference to object

2010-04-27 Thread Duncan Booth
Michal M wrote: > Hi > > I've just found out that one of objects is not destroyed when it > should be. This means that something was holding reference to this > object or part of it (i.e. method). Is there any way to check what > holds that reference? I am unable to do that just looking to the c

Re: How to check what is holding reference to object

2010-04-27 Thread Chris Rebert
On Tue, Apr 27, 2010 at 1:45 PM, Michal M wrote: > I've just found out that one of objects is not destroyed when it > should be. This means that something was holding reference to this > object or part of it (i.e. method). Is there any way to check what > holds that reference? I am unable to do th

Re: How to check what is holding reference to object

2010-04-27 Thread Almar Klein
> I've just found out that one of objects is not destroyed when it > should be. This means that something was holding reference to this > object or part of it (i.e. method). Is there any way to check what > holds that reference? I am unable to do that just looking to the code > or debugging it beca

Re: How to check what is holding reference to object

2010-04-27 Thread Xavier Ho
Michal, May I ask why do you care about the object's management? Let Python worry about that. What's your use case? -- http://mail.python.org/mailman/listinfo/python-list

How to check what is holding reference to object

2010-04-27 Thread Michal M
Hi I've just found out that one of objects is not destroyed when it should be. This means that something was holding reference to this object or part of it (i.e. method). Is there any way to check what holds that reference? I am unable to do that just looking to the code or debugging it because it

Re: how to check if a module is importable?

2010-01-20 Thread Robert P. J. Day
On Thu, 21 Jan 2010, Lie Ryan wrote: > On 01/20/10 19:58, Robert P. J. Day wrote: > > > > finally getting back to clawing my way thru the python 3 book so > > probably a number of newbie questions coming up. first one -- can i > > check if a module is importable (equivalently, exists on sys.pat

Re: how to check if a module is importable?

2010-01-20 Thread Lie Ryan
On 01/20/10 19:58, Robert P. J. Day wrote: > > finally getting back to clawing my way thru the python 3 book so > probably a number of newbie questions coming up. first one -- can i > check if a module is importable (equivalently, exists on sys.path, i > assume) without trying to import it firs

Re: how to check if a module is importable?

2010-01-20 Thread Jean-Michel Pichavant
Robert P. J. Day wrote: finally getting back to clawing my way thru the python 3 book so probably a number of newbie questions coming up. first one -- can i check if a module is importable (equivalently, exists on sys.path, i assume) without trying to import it first? i can see that i can u

how to check if a module is importable?

2010-01-20 Thread Robert P. J. Day
finally getting back to clawing my way thru the python 3 book so probably a number of newbie questions coming up. first one -- can i check if a module is importable (equivalently, exists on sys.path, i assume) without trying to import it first? i can see that i can use try/except and just ru

Re: How to check the exists of a name?

2009-10-19 Thread Piet van Oostrum
> David <71da...@libero.it> (D) wrote: >D> Il Sat, 17 Oct 2009 23:43:36 -0700 (PDT), StarWing ha scritto: >>> I got a idea, use a try...except statement. there are another way to >>> do it ? >>> >>> (I just curious now, because I solve my problem in another way :-) >D> locals().has_key(mynam

  1   2   3   4   >