Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Larry Martell
On Tue, Nov 11, 2014 at 11:00 AM, Marc Aymerich wrote: > On Tue, Nov 11, 2014 at 4:48 PM, Larry Martell > wrote: >> >> I have a PHP app that I want to convert to django. But I want to do it >> stages. All the heavy lifting is in the PHP code, so first, I want to >>

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Larry Martell
On Tue, Nov 11, 2014 at 12:18 PM, Marc Aymerich wrote: > On Tue, Nov 11, 2014 at 5:43 PM, Larry Martell > wrote: >> On Tue, Nov 11, 2014 at 11:00 AM, Marc Aymerich wrote: >>> On Tue, Nov 11, 2014 at 4:48 PM, Larry Martell >>> wrote: >>>> >>>

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Larry Martell
On Tue, Nov 11, 2014 at 11:43 AM, Joel Goldstick wrote: > On Tue, Nov 11, 2014 at 11:37 AM, Larry Martell > wrote: >> On Tue, Nov 11, 2014 at 10:54 AM, Chris Angelico wrote: >>> On Wed, Nov 12, 2014 at 2:48 AM, Larry Martell >>> wrote: >>>> Is there

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Larry Martell
On Tue, Nov 11, 2014 at 12:31 PM, Marc Aymerich wrote: > On Tue, Nov 11, 2014 at 6:26 PM, Larry Martell > wrote: >> On Tue, Nov 11, 2014 at 12:18 PM, Marc Aymerich wrote: >>> On Tue, Nov 11, 2014 at 5:43 PM, Larry Martell >>> wrote: >>>> On Tu

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-12 Thread Larry Martell
On Tue, Nov 11, 2014 at 10:48 AM, Larry Martell wrote: > I have a PHP app that I want to convert to django. But I want to do it > stages. All the heavy lifting is in the PHP code, so first, I want to > just use templates and views to generate the HTML, but still call the > PHP code

Re: Converting a PHP app to Python + Django (was: Communicating with a PHP script (and pretending I'm a browser))

2014-11-12 Thread Larry Martell
On Wed, Nov 12, 2014 at 12:54 PM, Ben Finney wrote: > Michael Torrie writes: > >> If the shop is entire a PHP shop, and no one knows python, then >> rewriting things in Python and Django is a really bad idea. > > It can be done well; see “Transitioning from PHP to Django on the sly” > http://pyvi

Re: Python IDE.

2014-11-20 Thread Larry Martell
On Thu, Nov 20, 2014 at 2:01 PM, wrote: > Can someone suggest a good python IDE. PyCharm, but it's not free. -- https://mail.python.org/mailman/listinfo/python-list

Setting default_factory of defaultdict to key

2014-12-01 Thread Larry Martell
Is there a way to set the default_factory of defaultdict so that accesses to undefined keys get to set to the key? i.e. if d['xxx'] were accessed and there was no key 'xxx' then d['xxx'] would get set to 'xxx' I know I can define a function with lambda for the default_factory, but I don't see how

Re: Setting default_factory of defaultdict to key

2014-12-01 Thread Larry Martell
On Mon, Dec 1, 2014 at 1:19 PM, Ethan Furman wrote: > On 12/01/2014 10:05 AM, Larry Martell wrote: >> >> Is there a way to set the default_factory of defaultdict so that >> accesses to undefined keys get to set to the key? > > You need to subclass and modify __missing__

Re: Setting default_factory of defaultdict to key

2014-12-01 Thread Larry Martell
On Mon, Dec 1, 2014 at 1:19 PM, Ethan Furman wrote: > On 12/01/2014 10:05 AM, Larry Martell wrote: >> >> Is there a way to set the default_factory of defaultdict so that >> accesses to undefined keys get to set to the key? > > You need to subclass and modify __missing__

Re: Setting default_factory of defaultdict to key

2014-12-01 Thread Larry Martell
On Mon, Dec 1, 2014 at 1:36 PM, Ethan Furman wrote: > On 12/01/2014 10:29 AM, Larry Martell wrote: >> On Mon, Dec 1, 2014 at 1:19 PM, Ethan Furman wrote: >>> On 12/01/2014 10:05 AM, Larry Martell wrote: >>>> >>>> Is there a way to set the default_facto

Re: Old newbie needs help.

2014-12-20 Thread Larry Martell
On Sat, Dec 20, 2014 at 11:34 AM, John Culleton wrote: > This week I wrote my first Python program, a script callable from Scribus, a > DTP program. It ran! Now I want to spread my wings a little. How do I call a > C language executable subprogram from Python and pass information back and > for

Re: kivy secret of mana game

2015-01-24 Thread Larry Martell
On Fri, Jan 23, 2015 at 3:44 PM, wrote: > On Friday, January 23, 2015 at 10:10:08 AM UTC-8, Tony the Tiger wrote: >> On Thu, 22 Jan 2015 17:13:12 +, Automn wrote: >> >> > game >> >> No interest, at all, nada, zilch. zero, nothing. >> >> /Grrr > > Why don't you like fun? I spend 10-12 hours

Installing PIL without internet access

2015-02-26 Thread Larry Martell
I have a host that has no access to the internet and I need to install PIL on it. I have an identical host that is on the internet and I have installed it there (with pip). Is there a way I can copy files from the connected host to a flash drive and then copy them to the unconnected host and have P

Re: Python programming

2014-02-12 Thread Larry Martell
On Tue, Feb 11, 2014 at 7:21 PM, ngangsia akumbo wrote: > Please i have a silly question to ask. > > How long did it take you to learn how to write programs? My entire life. I started in 1975 when I was 16 - taught myself BASIC and wrote a very crude downhill skiing game. I had dial in access to

Re: Python programming

2014-02-12 Thread Larry Martell
On Wed, Feb 12, 2014 at 9:13 AM, Roy Smith wrote: > In article , > Larry Martell wrote: > >> On Tue, Feb 11, 2014 at 7:21 PM, ngangsia akumbo wrote: >> > Please i have a silly question to ask. >> > >> > How long did it take you to learn how to wri

Top posting and double spacing

2014-02-12 Thread Larry Martell
My personal rule is that I will give people 1 or 2 chances after they are asked. If they continue to top post or send double space posts, I simply ignore everything from them until they get with the program. If we all did that maybe they'd get the message (but probably not). -- https://mail.python

Re: Python programming

2014-02-13 Thread Larry Martell
On Wed, Feb 12, 2014 at 10:56 PM, William Ray Wing wrote: > OK, and how many of you remember the original version of the tongue-in-cheek > essay "Real Programmers Don't Use Pascal" from the back page of Datamation? I do remember it. http://www.webcitation.org/659yh1oSh -- https://mail.python.o

Re: Newcomer Help

2014-02-13 Thread Larry Martell
On Thu, Feb 13, 2014 at 11:22 AM, Rustom Mody wrote: > > This is Usenet. You'll learn much here and you'll find a bunch of rude people. > > No you are not going to crash your plane but you will likely crash your > python-learning attempts if you give an occasional asshole more importance > than is

Re: Welcome to the Internet. No one here likes you. (was: Newcomer Help)

2014-02-13 Thread Larry Martell
On Thu, Feb 13, 2014 at 12:49 PM, John Ladasky wrote: > On Thursday, February 13, 2014 8:32:46 AM UTC-8, larry@gmail.com wrote: > >> This reminds me of post that was circulating in the early 90's: >> >> Welcome to the Internet. >> >> No one here likes you. >> >> We're going to offend, insult,

script uses up all memory

2014-03-05 Thread Larry Martell
I have a script that forks off other processes and attempts to manage them. Here is a stripped down version of the script: self.sleepTime = 300 self.procs = {} self.startTimes = {} self.cmd = ['python', '/usr/local/motor/motor/app/some_other_script.py'] whi

Re: script uses up all memory

2014-03-05 Thread Larry Martell
On Wed, Mar 5, 2014 at 5:39 PM, Chris Angelico wrote: > On Thu, Mar 6, 2014 at 9:27 AM, Larry Martell wrote: >> I have a script that forks off other processes and attempts to manage >> them. Here is a stripped down version of the script: >> >> self.sleepTime =

Re: script uses up all memory

2014-03-05 Thread Larry Martell
On Wed, Mar 5, 2014 at 7:33 PM, Chris Angelico wrote: > On Thu, Mar 6, 2014 at 11:20 AM, Larry Martell > wrote: >> On Wed, Mar 5, 2014 at 5:39 PM, Chris Angelico wrote: >>> On Thu, Mar 6, 2014 at 9:27 AM, Larry Martell >>> wrote: >>>> I have a

Re: script uses up all memory

2014-03-06 Thread Larry Martell
On Wed, Mar 5, 2014 at 5:27 PM, Larry Martell wrote: > I have a script that forks off other processes and attempts to manage > them. Here is a stripped down version of the script: > > self.sleepTime = 300 > self.procs = {} > self.startTimes = {}

Re: script uses up all memory

2014-03-06 Thread Larry Martell
On Thu, Mar 6, 2014 at 4:56 PM, Larry Martell wrote: > On Wed, Mar 5, 2014 at 5:27 PM, Larry Martell wrote: >> I have a script that forks off other processes and attempts to manage >> them. Here is a stripped down version of the script: >> >> self.sleepTime

Re: script uses up all memory

2014-03-06 Thread Larry Martell
On Thu, Mar 6, 2014 at 5:11 PM, Chris Angelico wrote: > On Fri, Mar 7, 2014 at 8:56 AM, Larry Martell wrote: >> I figured out what is causing this. Each pass through the loop it does: >> >> self.tools = Tool.objects.filter(ip__isnull=False) >> >> And t

Re: Github down?

2014-03-21 Thread Larry Martell
On Fri, Mar 21, 2014 at 9:22 AM, Skip Montanaro wrote: > Anybody else having trouble getting to Github? I'm trying to get to > the pythondotorg issue tracker: > > https://github.com/python/pythondotorg/issues They post the status at: https://twitter.com/githubstatus As of 10 minutes ago it was

Re: Github down?

2014-03-21 Thread Larry Martell
On Fri, Mar 21, 2014 at 9:48 AM, Skip Montanaro wrote: > On Fri, Mar 21, 2014 at 8:24 AM, Larry Martell > wrote: >> https://twitter.com/githubstatus > > Thanks for the pointer. I'm an old fart and don't use social media > much (in fact, just closed my FB accoun

Re: Time we switched to unicode? (was Explanation of this Python language feature?)

2014-03-25 Thread Larry Martell
On Tue, Mar 25, 2014 at 4:21 PM, Gregory Ewing wrote: > Roy Smith wrote: > >> Doors that open automatically as you approach them are now routine. >> > > Star Trek doors seem to be a bit smarter, though. > Captain Kirk never had to stop in front of a door > and wait for it to sluggishly slide open.

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Larry Martell
On Tue, Apr 8, 2014 at 3:07 AM, James Brewer wrote: > I'm sure there will be a substantial amount of arrogance perceived from this > question, but frankly I don't think that I have anything to learn from my > co-workers, which saddens me because I really like to learn and I know that > I have a lo

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Larry Martell
On Tue, Apr 8, 2014 at 11:02 AM, Chris Angelico wrote: > On Wed, Apr 9, 2014 at 12:28 AM, Larry Martell > wrote: >> I've worked at places where: > > Add to that list: > > - Some of the programmers really aren't programmers, but the boss just > hasn't fi

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Larry Martell
On Tue, Apr 8, 2014 at 11:33 AM, Chris Angelico wrote: > He was majorly turned off > by the whole thing of significant whitespace and basically just told > me "there will be no Python here". Bah.) I had programmed in perl for 20 years, then got a job at place where the boss made the edict "There

Re: Python 2.3 and ODBC

2014-04-08 Thread Larry Martell
On Tue, Apr 8, 2014 at 4:18 PM, Gabor Urban wrote: > Hi guys, > > I am using Python 2.3 on an XP box at my company. (I know it is quite > outdated, but we could not make the management to upgrade.) I have started a > pilot project the last week to show the possibility of processing incoming > XML

pyodbc connect string

2014-04-29 Thread Larry Martell
I am having a problem building a connect string for pyodbc. It works when everything is hard coded, but if I build the connect string it fails. This works: pyodbc.connect('DRIVER=FreeTDS;' 'SERVER=xx.xx.xx.xx;' 'PORT=1433;' 'DATABASE=blah;' 'UID=foo;' 'PWD=bar;') But this does not: pyodbc.conne

Re: pyodbc connect string

2014-04-29 Thread Larry Martell
On Tue, Apr 29, 2014 at 7:09 PM, Chris Angelico wrote: > On Wed, Apr 30, 2014 at 10:57 AM, Larry Martell > wrote: >> This works: >> >> pyodbc.connect('DRIVER=FreeTDS;' 'SERVER=xx.xx.xx.xx;' 'PORT=1433;' >> 'DATABASE=blah;'

Re: pyodbc connect string

2014-04-29 Thread Larry Martell
On Tue, Apr 29, 2014 at 7:14 PM, Ben Finney wrote: > Larry Martell writes: > >> I am having a problem building a connect string for pyodbc. It works >> when everything is hard coded, but if I build the connect string it >> fails. >> >> This works: >> &

Re: Python under the sea and in space

2014-05-08 Thread Larry Martell
On Tue, May 6, 2014 at 8:31 PM, Jessica McKellar wrote: > Hi folks, > > I'm trying to determine the greatest depth (in the ocean or underground) and > highest altitude at which Python code has been executed. I have written avionics data collection apps there were used in small general aviation ai

Python 3 is killing Python

2014-05-28 Thread Larry Martell
Somthing I came across in my travels through the ether: https://medium.com/@deliciousrobots/5d2ad703365d/ -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3 is killing Python

2014-05-28 Thread Larry Martell
On Wed, May 28, 2014 at 2:49 PM, Paul Rubin wrote: > Larry Martell writes: > > Somthing I came across in my travels through the ether: > > [1]https://medium.com/@deliciousrobots/5d2ad703365d/ > > "Python 3 can revive Python" https://medium.com/p/2a7af4788b10 &g

Re: Python 3 is killing Python

2014-05-29 Thread Larry Martell
On Wed, May 28, 2014 at 10:49 PM, Steven D'Aprano wrote: > On Wed, 28 May 2014 14:58:05 -0500, Larry Martell wrote: > > > On Wed, May 28, 2014 at 2:49 PM, Paul Rubin > > wrote: > > > >> Larry Martell writes: > >> > Somthing I came acros

Re: Installing PIL without internet access

2015-02-26 Thread Larry Martell
On Thu, Feb 26, 2015 at 11:57 AM, MRAB wrote: > On 2015-02-26 15:23, Larry Martell wrote: >> >> I have a host that has no access to the internet and I need to install >> PIL on it. I have an identical host that is on the internet and I have >> installed it there (with

regex help

2015-03-13 Thread Larry Martell
I need to remove all trailing zeros to the right of the decimal point, but leave one zero if it's whole number. For example, if I have this: 14S,5.,4.5686274500,3.7272727272727271,3.3947368421052630,5.7307692307692308,5.7547169811320753,4.9423076923076925,5.7884615384615383,5.1

Re: regex help

2015-03-13 Thread Larry Martell
On Fri, Mar 13, 2015 at 1:29 PM, MRAB wrote: > On 2015-03-13 16:05, Larry Martell wrote: >> >> I need to remove all trailing zeros to the right of the decimal point, >> but leave one zero if it's whole number. For example, if

Python 2.7 issue with decimal value 0.0

2015-03-25 Thread Larry Martell
I have an app that works with 2.6, but in 2.7 it is failing. I traced it down to an issue with decimal.Decimal being passed a value of 0.0. It 2.6 this is fine, but in 2.7 it throws an exception: TypeError: Cannot convert float to Decimal. First convert the float to a string This is easy enough

Re: Python 2.7 issue with decimal value 0.0

2015-03-25 Thread Larry Martell
On Wed, Mar 25, 2015 at 8:26 AM, Grant Edwards wrote: > On 2015-03-25, Larry Martell wrote: >> I have an app that works with 2.6, but in 2.7 it is failing. I traced >> it down to an issue with decimal.Decimal being passed a value of 0.0. >> It 2.6 this is fine, but in 2.7 i

Re: Python 2.7 issue with decimal value 0.0

2015-03-25 Thread Larry Martell
On Wed, Mar 25, 2015 at 10:44 AM, Ian Kelly wrote: > On Wed, Mar 25, 2015 at 8:36 AM, Larry Martell > wrote: >> On Wed, Mar 25, 2015 at 8:26 AM, Grant Edwards >> wrote: >>> On 2015-03-25, Larry Martell wrote: >>>> I have an app that works with 2.6, but

Re: Help with ElementTree

2015-04-09 Thread Larry Martell
On Thu, Apr 9, 2015 at 2:39 PM, Peter Otten <__pete...@web.de> wrote: > Larry Martell wrote: > >> I have an XML file that looks like this (this is just the pertinent >> part, the file is huge): >> >> >> >> >> >>

Re: Help with ElementTree

2015-04-09 Thread Larry Martell
On Thu, Apr 9, 2015 at 2:42 PM, Ben Finney wrote: > Larry Martell writes: > >> I have an XML file that looks like this (this is just the pertinent >> part, the file is huge): > > It's also not a very helpful schema. Elements called “Node”, where the > actual ty

Help with ElementTree

2015-04-09 Thread Larry Martell
I have an XML file that looks like this (this is just the pertinent part, the file is huge): KA21 KA21 00:00:00 15/03/2014 05:56:

Re: EuroPython 2015: Django Girls Workshop

2015-04-17 Thread Larry Martell
On Fri, Apr 17, 2015 at 4:31 PM, Marko Rauhamaa wrote: > beliav...@aol.com: > >> If your target audience is women, I think you should have termed it >> the Django Womens Workshop rather than the Django Girls Workshop. >> Referring to adults as children can be seen as condescending. > > You got it

Re: Enterprise Python

2015-04-25 Thread Larry Martell
On Fri, Apr 24, 2015 at 10:27 PM, Terry Reedy wrote: > Someone, (Mark, I believe), posted this link to a podcast from a few weeks > ago: > http://www.talkpythontome.com/episodes/show/4/enterprise-python-and-large-scale-projects > > A large part of that is based on this Dec 2014 post: > https://www

Re: Immediate Hire: Sr. Java Software Engineer - Oklahoma - GC, US Citizens Onlt

2015-05-11 Thread Larry Martell
I am only interested in work that I can do remotely from home. If you have any opportunities like that, please contact me. On Mon, May 11, 2015 at 11:12 AM, nagaraju thoudoju wrote: > Hi, > > Hope you are doing well, > > Please find the requirement below and let me know you interest on this > po

Re: Regular Expression

2015-06-04 Thread Larry Martell
On Thu, Jun 4, 2015 at 9:36 AM, Palpandi wrote: > > Hi All, > > This is the case. To split "string2" from "string1_string2" I am using > re.split('_', "string1_string2", 1)[1]. > > It is working fine for string "string1_string2" and output as "string2". But > actually the problem is that if a sti

Re: So what's happening here?

2015-06-05 Thread Larry Martell
On Fri, Jun 5, 2015 at 8:46 AM, Paul Appleby wrote: > I saw somewhere on the net that you can copy a list with slicing. So > what's happening when I try it with a numpy array? > a = numpy.array([1,2,3]) b = a[:] a is b > False b[1] = 9 a > array([1, 9, 3]) is is identity

Re: Is it a newsgroup or a list?

2015-06-07 Thread Larry Martell
On Sun, Jun 7, 2015 at 11:49 AM, Gene Heskett wrote: > You mentioned GoogleGroups, now go warsh yur mouth out with some of > Grandma's Lye soap. This list is 500% easier to read when they are > filtered out. I still see the responses but they are at least formatted > for readability. Gene is ver

Re: Parser needed.

2015-06-11 Thread Larry Martell
On Thu, Jun 11, 2015 at 8:35 AM, Joel Goldstick wrote: > but you aren't asking questions. You are having a conversation with > yourself on a public q/a list. Its unpleasant Well, he did mention masterbation in another post. -- https://mail.python.org/mailman/listinfo/python-list

Re: Gmail eats Python

2015-07-29 Thread Larry Martell
On Wed, Jul 29, 2015 at 10:51 AM, wrote: > On Sun, Jul 26, 2015, at 07:48, Marko Rauhamaa wrote: >> At first, there was only the machine language. Assembly languages >> introduced "mnemonics" for the weaklings who couldn't remember the >> opcodes by heart. > > To be fair, x86 is also a particular

Re: Python Developer- Houston, TX

2015-08-10 Thread Larry Martell
Can this be done remotely or only on-site? On Mon, Aug 10, 2015 at 3:24 PM, wrote: > Hi, > Hope you are doing well !!! > My name is Siva and I'm a recruiter at TheAppliedthought , a global staffing > and IT consulting company. > Please find the below job description which may suits any of your

sending push notifications

2015-09-03 Thread Larry Martell
I'm looking for people's experiences with the different ways to send push notifications to mobile devices. I have an app that will be running on Amazon, so I can use their SNS API or I can do it myself. >From googling there appear to be a few different packages but PyAPNs and python-gcm seem to be

Re: sending push notifications

2015-09-03 Thread Larry Martell
On Thu, Sep 3, 2015 at 8:54 AM, Laura Creighton wrote: > In a message of Thu, 03 Sep 2015 08:30:35 -0400, Larry Martell writes: >>I'm looking for people's experiences with the different ways to send >>push notifications to mobile devices. I have an app that will be >

mocking request and still getting certain ones locally

2015-09-07 Thread Larry Martell
I use the getsentry/responses package (https://github.com/getsentry/responses) for mocking the requests library for unit testing. It works great but now I have a situation where I need to talk to a local server but have my remote requests mocked out. With getsentry/responses I cannot do that - all

Re: passing double quotes in subprocess

2015-09-08 Thread Larry Martell
On Tue, Sep 8, 2015 at 7:03 AM, loial wrote: > I need to execute an external shell script via subprocess on Linux. > > One of the parameters needs to be passed inside double quotes > > But the double quotes do not appear to be passed to the script > > I am using : > > myscript = '/home/john/myscri

Getting response over logging socket

2015-09-09 Thread Larry Martell
I have an app that uses the logging package with a SocketHandler to send messages. Now I've been asked to change it so that it can receive a response for each log message sent. It appears there is no way to do this with logging package. Is that true? Can I not receive data over a socket used in a l

Catching exceptions from logging socket handler

2015-09-18 Thread Larry Martell
I have a socket logging handler and I want to be able to catch exceptions from it. Specifically, I want to know if the remote side has gone away so I can close the socket and reopen it when the remote side come back. What happens now is that I get Broken pipe and BAD_WRITE_RETRY exceptions, but it

sort help

2015-09-22 Thread Larry Martell
I currently have 3 lists of lists and I sort them based on a common field into a single list like this: def GetObjKey(a): return a[2] sorted(a + b + c, key=GetObjKey) Which works just fine. But now, I need to have just the first list (a) also sub sorted by another fi

Re: sort help

2015-09-23 Thread Larry Martell
On Tue, Sep 22, 2015 at 6:55 PM, Chris Angelico wrote: > On Wed, Sep 23, 2015 at 8:42 AM, Larry Martell > wrote: >> I currently have 3 lists of lists and I sort them based on a common >> field into a single list like this: >> >> def GetObjKey

Re: Oracle connect

2015-09-30 Thread Larry Martell
On Wed, Sep 30, 2015 at 11:25 AM, wrote: > Hi > New to Python and just downloaded 3.5 > Trying to connect to Oracle but failing - eg > > import cx_oracle > connstr = 'userid/password@@99.999.9.99:PORT/SID' > connection = cx_oracle.connect(connstr) > cursor = connection.cursor() > cursor.execute("

threading bug in strptime

2015-10-05 Thread Larry Martell
We have been trying to figure out an intermittent problem where a thread would fail with this: AttributeError: 'module' object has no attribute '_strptime' Even though we were importing datetime. After much banging our heads against the wall, we found this: http://code-trick.com/python-bug-attri

List comprehension with if-else

2015-10-28 Thread Larry Martell
I'm trying to do a list comprehension with an if and that requires an else, but in the else case I do not want anything added to the list. For example, if I do this: white_list = [l.control_hub.serial_number if l.wblist == wblist_enum['WHITE'] else None for l in wblist] I end up with None in my

Re: List comprehension with if-else

2015-10-28 Thread Larry Martell
On Wed, Oct 28, 2015 at 12:36 PM, Zachary Ware wrote: > On Wed, Oct 28, 2015 at 11:25 AM, Larry Martell > wrote: >> I'm trying to do a list comprehension with an if and that requires an >> else, but in the else case I do not want anything added to the list. >>

Re: Regular expressions

2015-11-06 Thread Larry Martell
On Fri, Nov 6, 2015 at 3:36 PM, Christian Gollwitzer wrote: > Am 06.11.15 um 20:52 schrieb ru...@yahoo.com: >> >> I have always thought lexing >> and parsing solutions for Python were a weak spot in the Python eco- >> system and I was about to write that I would love to see a PEG parser >> for pyt

Re: First time I looked at Python was(...)

2014-06-10 Thread Larry Martell
On Tue, Jun 10, 2014 at 4:51 PM, Mark Lawrence wrote: > On 10/06/2014 21:41, leo kirotawa wrote: >> >> Gzz, >> >> Guys I'm from Brazil too, and I'm ashamed for this troll. And sorry by >> his terrible taste in music. >> Wondering now about moderation , have we one? >> > > No, otherwise the residen

Re: How to get Timezone from latitude/longitude ?

2014-06-25 Thread Larry Martell
On Wed, Jun 25, 2014 at 8:53 AM, wrote: > Hi, > > I'm looking for a python-library which can help me to get Timezone and > Timezone-offset(UTC) from latitude/longitude. > > I'm not able to find an easy way to do it. > > Thanks in advance. It took me 30 seconds on google to find this: https://g

Blocked thread

2014-07-17 Thread Larry Martell
I have a python cx_Oracle script that does a delete from a table. Usually this takes well under 1 second. But sometimes it takes 1 to 2 minutes. I wanted to monitor that delete and if it's taking too long I want to see what is blocking it. I run the delete sql in a thread and I do this: while sel

Re: Blocked thread

2014-07-17 Thread Larry Martell
On Thu, Jul 17, 2014 at 1:32 PM, Chris Angelico wrote: > On Fri, Jul 18, 2014 at 2:26 AM, Larry Martell > wrote: >> I have a python cx_Oracle script that does a delete from a table. >> Usually this takes well under 1 second. But sometimes it takes 1 to 2 >> minutes.

Re: Blocked thread

2014-07-17 Thread Larry Martell
On Thu, Jul 17, 2014 at 1:46 PM, Skip Montanaro wrote: > > On Thu, Jul 17, 2014 at 12:32 PM, Chris Angelico wrote: >> >> I don't know Oracle specifically, but if it's anything like >> PostgreSQL, you'll probably do better with a completely separate >> connection to the server > > > Agreed. We use

Re: Blocked thread

2014-07-17 Thread Larry Martell
On Thu, Jul 17, 2014 at 2:01 PM, Chris Angelico wrote: > On Fri, Jul 18, 2014 at 3:55 AM, Larry Martell > wrote: >> I can have as many connections to the db server as I want, that's not >> the issue. The issue is that my main thread seems to be blocked in the >> jo

Re: Blocked thread

2014-07-17 Thread Larry Martell
On Thu, Jul 17, 2014 at 2:04 PM, Chris Angelico wrote: > On Fri, Jul 18, 2014 at 4:00 AM, Larry Martell > wrote: >> I did ask my DBA - he said "Blocking is a normal part of database >> operations. It's only a problem when it's a deadlock, in which case >>

Re: Blocked thread

2014-07-17 Thread Larry Martell
On Thu, Jul 17, 2014 at 2:09 PM, Chris Angelico wrote: > On Fri, Jul 18, 2014 at 4:03 AM, Larry Martell > wrote: >> On Thu, Jul 17, 2014 at 2:01 PM, Chris Angelico wrote: >>> On Fri, Jul 18, 2014 at 3:55 AM, Larry Martell >>> wrote: >>>> I can have

Re: Python 3 is killing Python

2014-07-18 Thread Larry Martell
On Fri, Jul 18, 2014 at 8:19 AM, Grant Edwards wrote: > But, I do know that a > decent, civilized person just doesn't make insulting comments like > that about somebody else's work even if it is true (which I very much > doubt). Now, _that's_ funny. This is the internet. If you can't stand the he

Re: Newbie needing some help

2014-08-08 Thread Larry Martell
On Fri, Aug 8, 2014 at 3:07 PM, Matt Smith wrote: > I am trying to write a program that will loop through a text file and delete > rows in a mysql database. > > It seemingly runs but I don't see anything getting deleted in the db. > Is there anything apparent that I am missing? > > This is the cod

Re: how to get the ordinal number in list

2014-08-08 Thread Larry Martell
On Sat, Aug 9, 2014 at 1:22 PM, luofeiyu wrote: x=["x1","x3","x7","x5"] y="x3" > > how can i get the ordinal number by some codes? > > for id ,value in enumerate(x): > if y==value : print(id) > > Is more simple way to do that? print x.index(y) -- https://mail.python.org/mailman/li

Re: Python in financial services

2014-08-12 Thread Larry Martell
On Tue, Aug 12, 2014 at 3:33 AM, Rustom Mody wrote: > Ive been asked to formulate a python course for financial services folk. > > If I actually knew about the subject, I'd have fatter pockets! > Anyway heres some thoughts. What I am missing out? > > [Apart from basic python -- contents typically

Re: Why can not initialize the class?

2014-08-22 Thread Larry Martell
On Fri, Aug 22, 2014 at 10:26 AM, luofeiyu wrote: > System:win7+python34. > > class Contact(object): > def __init__(self, first_name=None, last_name=None, > display_name=None, email=None): > self.first_name = first_name > self.last_name = la

Re: Why can not initialize the class?

2014-08-22 Thread Larry Martell
On Fri, Aug 22, 2014 at 10:58 AM, luofeiyu wrote: class Contact(object): > ... def __init__(self, first_name=None, last_name=None, > ... display_name=None, email="haha@haha"): > ... self.first_name = first_name > ... self.last_name = last_name > ...

hashlib suddenly broken

2014-09-18 Thread Larry Martell
I am on a mac running 10.8.5, python 2.7 Suddenly, many of my scripts started failing with: ValueError: unsupported hash type sha1 Googling this showed that it's an issue with hashlib with a common cause being a file called hashlib.py that gets in the way of the interpreter finding the standard

Re: hashlib suddenly broken

2014-09-18 Thread Larry Martell
On Thu, Sep 18, 2014 at 10:47 AM, John Gordon wrote: > In Larry Martell > writes: > >> Googling this showed that it's an issue with hashlib with a common >> cause being a file called hashlib.py that gets in the way of the >> interpreter finding the standard

Re: hashlib suddenly broken

2014-09-18 Thread Larry Martell
On Thu, Sep 18, 2014 at 11:18 AM, Chris Angelico wrote: > On Fri, Sep 19, 2014 at 3:07 AM, Steven D'Aprano > wrote: >> but I expect that's probably not where the problem lies. My *wild guess* is >> that your system updated SSL, and removed some underlying SHA-1 library >> needed by hashlib. SHA-1

Re: hashlib suddenly broken

2014-09-18 Thread Larry Martell
On Thu, Sep 18, 2014 at 11:07 AM, Steven D'Aprano wrote: > Larry Martell wrote: > >> I am on a mac running 10.8.5, python 2.7 >> >> Suddenly, many of my scripts started failing with: >> >> ValueError: unsupported hash type sha1 > [...] >> This ju

Re: hashlib suddenly broken

2014-09-18 Thread Larry Martell
On Thu, Sep 18, 2014 at 1:22 PM, Larry Martell wrote: > On Thu, Sep 18, 2014 at 11:07 AM, Steven D'Aprano > wrote: >> Larry Martell wrote: >> >>> I am on a mac running 10.8.5, python 2.7 >>> >>> Suddenly, many of my scripts started failing wi

Re: hashlib suddenly broken

2014-09-18 Thread Larry Martell
On Thu, Sep 18, 2014 at 2:21 PM, John Gordon wrote: > In Larry Martell > writes: > >> It's failing on the 'import _sha' in hashlib.py: > >> 66 def __get_builtin_constructor(name): >> 67try: >> 68 if name in (&#x

Re: hashlib suddenly broken

2014-09-18 Thread Larry Martell
On Thu, Sep 18, 2014 at 2:44 PM, Ned Deily wrote: > In article > , > Larry Martell wrote: >> On Thu, Sep 18, 2014 at 1:22 PM, Larry Martell >> wrote: >> > On Thu, Sep 18, 2014 at 11:07 AM, Steven D'Aprano >> > wrote: >> >> Larry Martel

Re: hashlib suddenly broken

2014-09-18 Thread Larry Martell
On Thu, Sep 18, 2014 at 2:49 PM, Christian Heimes wrote: > On 18.09.2014 21:23, Larry Martell wrote: >> On Thu, Sep 18, 2014 at 11:18 AM, Chris Angelico wrote: >>> On Fri, Sep 19, 2014 at 3:07 AM, Steven D'Aprano >>> wrote: >>>> but I expect that

Re: hashlib suddenly broken

2014-09-19 Thread Larry Martell
On Thu, Sep 18, 2014 at 11:00 PM, Steven D'Aprano wrote: > Ned Deily wrote: > >> In article >> , >> Larry Martell wrote: >>> Do you think I should install this update? Perhaps that would restore >>> whatever is missing. >> >> Yes. You

Re: Love to get some feedback on my first python app!!!

2014-09-22 Thread Larry Martell
On Mon, Sep 22, 2014 at 8:23 AM, Chris Angelico wrote: > So, comments would definitely help. In some cases, would help a lot. This is me: http://xkcd.com/1421/ -- https://mail.python.org/mailman/listinfo/python-list

Best way to deal with different data types in a list comprehension

2014-09-23 Thread Larry Martell
I have some code that I inherited: ' '.join([self.get_abbrev()] + [str(f['value') for f in self.filters if f.has_key('value')]).strip() This broke today when it encountered some non-ascii data. I changed the str(f['value']) line to f['value'].encode('utf-8'),

Re: Best way to deal with different data types in a list comprehension

2014-09-23 Thread Larry Martell
On Tue, Sep 23, 2014 at 6:05 PM, Rock Neurotiko wrote: > 2014-09-24 0:01 GMT+02:00 Larry Martell : >> >> I have some code that I inherited: >> >> ' '.join([self.get_abbrev()] + >>[str(f['value') >> for f i

Re: Storage Cost Calculation

2014-09-27 Thread Larry Martell
On Sat, Sep 27, 2014 at 7:18 AM, Chris Angelico wrote: > On Sat, Sep 27, 2014 at 9:14 PM, Skip Montanaro > wrote: > > On Sep 27, 2014 1:06 AM, "Chris Angelico" wrote: > >> > > > >> We are not going to do your homework for you. > > > > Perhaps it was a take home test... What then? :-) > > Then w

Re: Storage Cost Calculation

2014-09-27 Thread Larry Martell
On Sat, Sep 27, 2014 at 7:18 AM, Chris Angelico wrote: > On Sat, Sep 27, 2014 at 9:14 PM, Skip Montanaro > wrote: > > On Sep 27, 2014 1:06 AM, "Chris Angelico" wrote: > >> > > > >> We are not going to do your homework for you. > > > > Perhaps it was a take home test... What then? :-) > > Then w

Re: Regular expression query

2017-03-12 Thread Larry Martell
On Sun, Mar 12, 2017 at 12:22 PM, wrote: > Hi All, > > I have a string which looks like > > a,b,c "4873898374", d, ee "3343,23,23,5,,5,45", f > "5546,3434,345,34,34,5,34,543,7" > > It is comma saperated string, but some of the fields have a double quoted > string as part

<    1   2   3   4   5   >