Re: How to pass class instance to a method?

2012-11-26 Thread Dave Angel
On 11/26/2012 06:07 PM, Ian Kelly wrote: > On Mon, Nov 26, 2012 at 2:58 PM, Dave Angel wrote: >> Not how I would put it. In a statically typed language, the valid types >> are directly implied by the function parameter declarations, > As alluded to in my previous post, not al

Re: How to pass class instance to a method?

2012-11-26 Thread Dave Angel
On 11/26/2012 05:18 PM, Steven D'Aprano wrote: > On Mon, 26 Nov 2012 16:58:47 -0500, Dave Angel wrote: > >> In a statically typed language, the valid types >> are directly implied by the function parameter declarations, while in a >> dynamic language, they're defi

Re: Compare list entry from csv files

2012-11-26 Thread Dave Angel
On 11/26/2012 05:27 PM, Anatoli Hristov wrote: > I understand, but in my case I have for sure the field "Name" in the > second file that contains at least the first or the last name on it... > So probably it should be possible:) > The Name "Billgatesmicrosoft" contains the word "Gates" so logically

Re: How to pass class instance to a method?

2012-11-26 Thread Dave Angel
On 11/26/2012 11:10 PM, Steven D'Aprano wrote: > On Mon, 26 Nov 2012 22:14:59 -0500, Dave Angel wrote: > >> On 11/26/2012 05:18 PM, Steven D'Aprano wrote: >>> On Mon, 26 Nov 2012 16:58:47 -0500, Dave Angel wrote: >>> >>>> In a statically typed la

Re: Python dictionaries are awesome

2012-11-26 Thread Dave Angel
On 11/26/2012 09:32 PM, Steven D'Aprano wrote: > ... especially when you consider how some other languages implement them. > > > http://twistedoakgames.com/blog/?p=925 > > [quote] > Here’s the hypothetical situation: you’re making a flash game. In that > game users can create named profiles. You s

Re: Compare list entry from csv files

2012-11-27 Thread Dave Angel
On 11/27/2012 01:57 PM, Anatoli Hristov wrote: > > > Thank you all for the help, but I figured that out and the program now > works perfect. Wow! > I would appreciate if you have some notes about my > script as I'm noob :) > Here is the code: > > import csv > > origf = open('c:/Working/Test_pho

Re: Compare list entry from csv files

2012-11-29 Thread Dave Angel
On 11/29/2012 05:22 AM, Anatoli Hristov wrote: > > Hello, > > Tried to document a little bit the script, but I'm not that good in that too > :) > > The only problem I have is that I cant compare other field than the > first one in > for ex_phone in phones: > telstr = ex_phone[0].lower() >

Re: amazing scope?

2012-11-30 Thread Dave Angel
On 11/30/2012 11:05 AM, andrea crotti wrote: > Well I knew that this works fine, even if I feel a bit guilty to do > this, and better is: > > foo = 'bar' if some_condition else 'baz' > > Anyway for me the suprise is that something that is defined *later* at > the module scope is found in a function

Re: Textmining

2012-11-30 Thread Dave Angel
On 11/30/2012 02:48 PM, subhabangal...@gmail.com wrote: > Dear Group, > Python has one textming library, but I am failing to install it in Windows. > If any one can kindly help. > Regards, > Subhabrata. Please think about what you're asking, if you want people to help you. You say Python has a te

Re: setup.py Choosing Older Compiler On Windows

2012-12-02 Thread Dave Angel
On 12/02/2012 09:34 AM, Ami Tavory wrote: > Hello, > > I'm porting a C++ extension module to a Windows machine that has both VC8 > and VC10 installed. Unfortunately, `setup.py build` tries to build using > VC8, which fails (the extension uses C++ standard libraries that VC didn't > used to hav

Re: Puzzling error msg.

2012-12-03 Thread Dave Angel
On 12/03/2012 03:33 PM, Chris Angelico wrote: > > Is it possible that the error actually came from further up (with a > faulty line number) and was actually because communicate() somehow > returned an empty list? That's the only place in the code quoted that > I'm seeing indexing, but communicate(

Re: Puzzling error msg.

2012-12-03 Thread Dave Angel
On 12/03/2012 10:28 PM, Chris Angelico wrote: > On Tue, Dec 4, 2012 at 1:28 PM, Dave Angel wrote: >> On 12/03/2012 03:33 PM, Chris Angelico wrote: >>> >>> Is it possible that the error actually came from further up (with a >>> faulty line number) and was ac

Re: Python Cluster

2012-12-04 Thread Dave Angel
On 12/04/2012 02:04 PM, subhabangal...@gmail.com wrote: > Dear Group, > > I am trying to use the cluster module as, from cluster import * No such module in the stdlib. Start by showing what OS, what Python version, and what external libraries you've installed and are using, and only then can

Re: assign only first few items of a tuple/list

2012-12-04 Thread Dave Angel
On 12/04/2012 04:36 PM, Chris Angelico wrote: > On Wed, Dec 5, 2012 at 8:25 AM, Daniel Fetchinson > wrote: >> Hi folks, I swear I used to know this but can't find it anywhere. >> Say I have a list x = [ 1,2,3,4,5 ] and only care about the first two items. >> I'd like to assign the first two items

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

Re: Secretly passing parameter to function

2012-12-05 Thread Dave Angel
On 12/05/2012 01:50 PM, Olivier Scalbert wrote: > Hi all ! > > I have a problem that is not easy to explained, so I have tried to > reduce it a lot. > > We are using a framework, that we can not modify. > > in framework.py: > def do(something): >''' >Here we are in a framework that can not

Re: mini browser with python

2012-12-05 Thread Dave Angel
On 12/05/2012 04:19 PM, inq1ltd wrote: > > > I need to view the code as if > I were opening it with a browser. > > Now, I set KWrite to read the code just > as Firefox does. > I want to incorporate a mini browser > in a module to do the same. > > regards, > jimonlinux > > > You still haven't g

Re: Confused compare function :)

2012-12-06 Thread Dave Angel
On 12/06/2012 08:58 AM, Chris Angelico wrote: > On Fri, Dec 7, 2012 at 12:33 AM, Thomas Rachel > > wrote: >> Am 06.12.2012 09:49 schrieb Bruno Dupuis: >> >>> The point is Exceptions are made for error handling, not for normal >>> workflow. I hate when i read that for example: >>> >>> try: >>>

Re: problem with usbtmc-communication

2012-12-06 Thread Dave Angel
On 12/06/2012 02:41 PM, Jean Dubois wrote: > On 6 dec, 15:50, w...@mac.com wrote: >> >> Sorry about the misunderstanding (and subsequent waste of bandwidth). >> However, if you will look at the serial reads and writes in that handler, >> you will see that it does things like "serial.read(n)" wh

Re: An object is and isn't an instance of a class at the same time

2012-12-09 Thread Dave Angel
On 12/09/2012 07:31 PM, Chris Angelico wrote: > On Mon, Dec 10, 2012 at 10:34 AM, danielk wrote: >> D:\home\python>python jtest.py >> >> Traceback (most recent call last): >> File "jtest.py", line 4, in >> executeResults = jc.execute(cmnd) >> File "D:\home\python\jukebox\jconnection.py",

Re: Creating different classes dynamically?

2012-12-09 Thread Dave Angel
On 12/09/2012 07:35 PM, Victor Hooi wrote: > Hi, > > I have a directory tree with various XML configuration files. > > I then have separate classes for each type, which all inherit from a base. > E.g. > > class AnimalConfigurationParser: > ... > > class DogConfigurationParser(Anima

Re: TypeError: 'in ' requires string as left operand, not Element

2012-12-09 Thread Dave Angel
On 12/09/2012 07:52 PM, Victor Hooi wrote: > Hi, > > I'm getting a strange error when I try to run the following: > > for root, dirs, files in os.walk('./'): > for file in files: > if file.startswith('ml') and file.endswith('.xml') and 'entity' > not in file: >

Re: About open file for Read

2012-12-10 Thread Dave Angel
On 12/10/2012 11:36 AM, moonhkt wrote: > Hi All > > I am new in Python. When using open and then for line in f . > > Does it read all the data into f object ? or read line by line ? > > > f=open(file, 'r') >for line in f: > if userstring in line: > print

Re: date-time comparison, aware vs naive

2012-12-10 Thread Dave Angel
On 12/10/2012 03:52 PM, Steven D'Aprano wrote: > On Mon, 10 Dec 2012 11:57:37 -0800, noydb wrote: > >> I want to compare a user entered date-and-time against the date-and-time >> of a pdf file. I posted on this (how to get a file's date-time) before, >> was advised to do it like: >> >> import date

Re: strptime - dates formatted differently on different computers

2012-12-10 Thread Dave Angel
On 12/10/2012 04:18 PM, noydb wrote: > Follow-on question to this earlier topic - > https://groups.google.com/d/topic/comp.lang.python/wnUlPBBNah8/discussion For those who avoid googlegroups with a passion, and/or don't have internet access, the subject of that thread is "date-time comparison, a

ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-10 Thread Dave Cinege
ng to generate output or command lines for external programs, or wish you had a dictionary that could act (sort of) like a class, Thesaurus may be for you. #!/usr/bin/env python """ thesaurus.py 2012-09-13 Copyright (c) 2012 Dave Cinege Licence: python, Copyright notice may not be al

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-11 Thread Dave Cinege
n of (global) data. It's not about string formatting. It's about organizing data and recursive retrieval of that data. > Lastly, you have several bare "except" clauses in the code. Bare Not going to get into religion. There is no 'correct' way to do this code

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-11 Thread Dave Cinege
>>> import thesaurus >>> thes = thesaurus.Thesaurus >>> t = thes() >>> t.spam = thes() >>> t.spam.ham = 'cheese' >>> print t.spam.ham >cheese >>> print t['spam'].ham >cheese >>> print t['spam']['ham']

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-11 Thread Dave Cinege
;m releasing it now because a python coder I contracted to pick up some slack for me saw this and went ape at how much he liked it...and that prompted me to finally get it out into the wild. As for in depth discussion and enhancement to this, I lack the time. Dave -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with print and output to screen

2012-12-11 Thread Dave Angel
On 12/11/2012 05:31 PM, Mike wrote: > Hello, I am learning python and i have the next problem and i not understand > how fix. > The script is very simple, shows in the terminal the command but, the row is > divided in two: > Example: > > > /opt/zimbra/bin/zmprov ga u...@example.com > |egrep "(z

Re: Problem with print and output to screen

2012-12-11 Thread Dave Angel
On 12/11/2012 05:53 PM, Joel Goldstick wrote: > When you read the file line by line the end of line character is included > in the result > > try user[:-1] instead to strip the return from your printed text > The catch to that is the last line in the file might not have a newline. In that case, w

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-11 Thread Dave Cinege
On Tuesday 11 December 2012 17:39:12 Dave Cinege wrote: My memory is getting jogged more why did some things: raise KeyError(key + ' [%s]' % i) I did this to specificly give you the indice that failed recursion but provide the entire key name as it was provided to __getite

Re: Error .. Please Help

2012-12-12 Thread Dave Angel
On 12/12/2012 10:00 AM, inshu chauhan wrote: > In this code : > > import cv > g = open("PointCloudmitClass.txt", "w") > image = cv.LoadImageM("Z:/modules/intensity_01.tif", > cv.CV_LOAD_IMAGE_UNCHANGED) > print image > for y in xrange(0,image.height): > for x in xrange(0,image.width): >

Re: How to import module whose filename starts number

2012-12-12 Thread Dave Angel
On 12/12/2012 12:42 PM, Yong Hu wrote: > I have a few scripts whose file names start with numbers. For example, > 01_step1.py, 02_step2.py > > I tried to import them in another script by "import 01_step1" or "from > 01_step1 import *". Both failed, saying "SyntaxError: invalid syntax" > > Is ther

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-12 Thread Dave Cinege
On Wednesday 12 December 2012 05:25:11 D'Arcy J.M. Cain wrote: As a 16yr OSS vet I know that for every 1 person that that actually creates something there will always be 2000 people to bitch about it. My skin isn't thin, I just don't give a shit to listen to anyone one that doesn't get it. The

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-12 Thread Dave Cinege
ute__ return self.__getitem__(name) RuntimeError: maximum recursion depth exceeded while calling a Python object This takes me into the same hell as when I was trying to implement this as a class. Someone else would have to take the time to do this. __getattr__ doing what I expect it to do, for what i

Re: Python parser problem

2012-12-12 Thread Dave Angel
On 12/12/2012 02:10 PM, RCU wrote: > Hello. > I would like to report a parser bug manifesting on Python 2.5, 2.7 > (but not on 2.2) and 3.3. > Please see the attached script. > Basically this bug appeared after applying PythonTidy on a valid > script. > > More exactly, when runnin

Re: Preventing tread collisions

2012-12-12 Thread Dave Angel
On 12/12/2012 03:11 PM, Wanderer wrote: > I have a program that has a main GUI and a camera. In the main GUI, you can > manipulate the images taken by the camera. You can also use the menu to check > the camera's settings. Images are taken by the camera in a separate thread, > so the long exposu

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-12 Thread Dave Cinege
'd really like to hear is that someone reading was curious enough to convert some existing code and their joy or displeasure with the experience. Dave -- http://mail.python.org/mailman/listinfo/python-list

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-12 Thread Dave Cinege
On Wednesday 12 December 2012 20:14:08 Chris Angelico wrote: Ok enough already, I'll use the frigging thing! Be happy I'm at least still not coding for python 1.5. > To add to this: Using enumerate gives the possibility (don't know if > any current interpreter takes advantage or not, but a futur

ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes - v20121212

2012-12-12 Thread Dave Cinege
Version 20121212 #!/usr/bin/env python """ thesaurus.py 2012-12-12 Copyright (c) 2012 Dave Cinege Licence: PSF Licence, Copyright notice may not be altered. Thesaurus: A different way to call a dictionary. Thesaurus is a new a dictionary subclass which allows calling keys as if

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-12 Thread Dave Cinege
this now. Dave -- http://mail.python.org/mailman/listinfo/python-list

Re: Error .. Please Help

2012-12-13 Thread Dave Angel
On 12/13/2012 04:23 AM, inshu chauhan wrote: >> >> if-else doesn't define a loop, but each of the for statements do. >> >> You have defined a classification for 8 of the possible colors, leaving >> millions of them undefined. If the first time through the loop you >> manage to hit one of those und

Re: Help with unittest2

2012-12-13 Thread Dave Angel
On 12/13/2012 10:03 AM, Daniel Laird wrote: > All, > > I am new to python and am stuck with python 2.6 (Ubuntu 10.04 and dont want > to force switch to 2.7) > I want to use assertListEqual and other new test functions. > However > I do am import unittest2 as unittest > The code does not fail but a

Re: Preventing tread collisions

2012-12-13 Thread Dave Angel
On 12/13/2012 11:36 AM, Wanderer wrote: > > > Thanks. Why Non-blocking? You said you didn't want the GUI to lock up. Non-blocking lets you choose alternative action when you would otherwise have to wait for the resource. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list

Re: What are the minimum requirements to get a job in?

2012-12-13 Thread Dave Angel
On 12/13/2012 09:49 PM, suresh.pinn...@gmail.com wrote: > My aim is to get a job into google or cisco or facebok. > I have basic knowledge in python,c,java and good in javascript,html,css, > database concepts. > If i learn django and python. Shall I get my dream job? > > Please suggest me You did

Re: What are the minimum requirements to get a job in?

2012-12-13 Thread Dave Angel
On 12/13/2012 10:33 PM, Dave Angel wrote: > On 12/13/2012 09:49 PM, suresh.pinn...@gmail.com wrote: >> My aim is to get a job into google or cisco or facebok. >> I have basic knowledge in python,c,java and good in javascript,html,css, >> database concepts. >> If i learn

Re: What are the minimum requirements to get a job in?

2012-12-14 Thread Dave Angel
On 12/14/2012 01:56 AM, Devin Jeanpierre wrote: > On Fri, Dec 14, 2012 at 1:13 AM, rusi wrote: >> On Dec 14, 8:33 am, Dave Angel wrote: >>> Do you know any one computer language thoroughly? Or just a little of >>> many languages? >> There is a quote by Bru

Re: Unicode

2012-12-16 Thread Dave Angel
On 12/16/2012 04:10 PM, Anatoli Hristov wrote: > Hello guys, > > I'm using Linux CentOS and Python 2.4 with MySQL 5.xx, I get error > with Unicode I tried many things that I found on the net but none of > them working. > > If I dont use UTF-8 it inserts the data into the DB but some French > char.

Re: Supporting list()

2012-12-17 Thread Dave Angel
On 12/17/2012 09:33 AM, Skip Montanaro wrote: > What method(s) does a class have to support to properly emulate a container > which supports turning it into a list? For example: > > class Foo: > pass > > f = Foo() > print list(f) > > Is it just __iter__() and next()? (I'm still using 2.

Re: Supporting list()

2012-12-17 Thread Dave Angel
On 12/17/2012 06:27 PM, Ethan Furman wrote: > Dave Angel wrote: >> On 12/17/2012 09:33 AM, Skip Montanaro wrote: >>> What method(s) does a class have to support to properly emulate a >>> container >>> which supports turning it into a list? For exampl

Re: Delete dict and subdict items of some name

2012-12-17 Thread Dave Angel
On 12/17/2012 12:27 PM, Gnarlodious wrote: > Hello. What I want to do is delete every dictionary key/value of the name > 'Favicon' regardless of depth in subdicts, of which there are many. What is > the best way to do it? > > -- Gnarlie I would write a recursive function that accepts a dict. In

Re: Unicode

2012-12-17 Thread Dave Angel
On 12/17/2012 12:43 PM, Anatoli Hristov wrote: >> Hi, >> I don't know, what the product ID would look like, for this page, but >> assuming, the catalog pages are also utf-8 encoded as well as the >> error page I get, it should work ok; cf.: > You are right, I get it work on Windows too, but not in

Re: Unicode

2012-12-17 Thread Dave Angel
On 12/17/2012 03:00 PM, Anatoli Hristov wrote: >> I fixed the print, I changed the setting of the terminal and also on >> the sshconfig, so now when I print I'm able to print out without >> problems, but when I tried to run the script I've made it gives me >> again the same error : >> ""Unexpected

Re: Delete dict and subdict items of some name

2012-12-17 Thread Dave Angel
On 12/17/2012 04:33 PM, Mitya Sirenef wrote: > On 12/17/2012 01:30 PM, Tim Chase wrote: >> On 12/17/12 11:43, Mitya Sirenef wrote: >>> On 12/17/2012 12:27 PM, Gnarlodious wrote: Hello. What I want to do is delete every dictionary key/value of the name 'Favicon' regardless of depth in subd

Re: Delete dict and subdict items of some name

2012-12-17 Thread Dave Angel
On 12/17/2012 06:08 PM, MRAB wrote: > On 2012-12-17 22:00, Dave Angel wrote: >> On 12/17/2012 04:33 PM, Mitya Sirenef wrote: >>> On 12/17/2012 01:30 PM, Tim Chase wrote: >>>> On 12/17/12 11:43, Mitya Sirenef wrote: >>>>> On 12/17/2012 12:27 PM, Gnarlodi

Re: os.system and subprocess odd behavior

2012-12-18 Thread Dave Angel
On 12/18/2012 05:27 AM, Hans Mulder wrote: > On 18/12/12 06:10:43, photonym...@gmail.com wrote: >> I hope I understand the question... but shouldn't you wait for the process >> to complete before exiting? >> >> Something like: >> >> pid = subprocess.Popen(...) >> pid.wait() >> >> Otherwise, it'll

Re: [newbie] problem making equally spaced value array with linspace

2012-12-18 Thread Dave Angel
On 12/18/2012 07:37 AM, Jean Dubois wrote: > I have trouble with the code beneath to make an array with equally > spaced values > When I enter 100e-6 as start value, 700e-6 as end value and 100e-6 I > get the following result: > [ 0.0001 0.00022 0.00034 0.00046 0.00058 0.0007 ] > But I was ho

Re: Problem with Threads

2012-12-19 Thread Dave Angel
On 12/19/2012 12:11 PM, Kwnstantinos Euaggelidis wrote: > I have this code for Prime Numbers and i want to do it with Threads.. Any > idea.?? Why do you want to do it with threads? Is it to speed up the processing? (Guessing that partly because of your printing "elapsed time." Chances are runni

Re: Strange effect with import

2012-12-20 Thread Dave Angel
On 12/20/2012 03:39 PM, Jens Thoms Toerring wrote: > Hi, > >I hope that this isn't a stupid question, asked already a > hundred times, but I haven't found anything definitive on > the problem I got bitten by. I have two Python files like > this: > > S1.py -- > import random > impor

Re: Data Driven Process

2012-12-20 Thread Dave Angel
On 12/20/2012 01:08 PM, balpar...@gmail.com wrote: > Thank you for your reply Grant, > > I am trying to attach mxd's but no chance. As you said that i dont have much > experience in python. I used to work with VBA but its not an option anymore > with new ArcGIS 10. > > How can I add mxd's here?

Re: help with making my code more efficient

2012-12-20 Thread Dave Angel
On 12/20/2012 07:19 PM, larry.mart...@gmail.com wrote: > I have a list of tuples that contains a tool_id, a time, and a message. I > want to select from this list all the elements where the message matches some > string, and all the other elements where the time is within some diff of any > matc

Re: help with making my code more efficient

2012-12-20 Thread Dave Angel
On 12/20/2012 08:46 PM, larry.mart...@gmail.com wrote: > On Thursday, December 20, 2012 6:17:04 PM UTC-7, Dave Angel wrote: >> > Of course it's a fragment - it's part of a large program and I was just > showing the relevant parts. But it seems these are methods in

Re: how to detect the encoding used for a specific text data ?

2012-12-21 Thread Dave Angel
On 12/21/2012 07:38 AM, Oscar Benjamin wrote: > > On a related note: how to answer question with no context on mailing > list? Depends on how you're reading/responding. I'll assume you're using an email client like Thunderbird, and that you do NOT subscribe in digest form. Most general way is

Re: redirect standard output problem

2012-12-21 Thread Dave Angel
On 12/21/2012 12:23 AM, iMath wrote: > redirect standard output problem > > why the result only print A but leave out 888 ? > > import sys > class RedirectStdoutTo: > > def __init__(self, out_new): > self.out_new = out_new > def __enter__(self): > sys.stdout = self.out_new >

Re: Scrapy/XPath help

2012-12-21 Thread Dave Angel
On 12/21/2012 04:58 PM, Always Learning wrote: > Sorry about that. I'm using Python 2.7.3, 32 bit one Windows 7. > > The errors I get are > >>> File >>> "C:\python27\lib\site-packages\scrapy-0.16.3-py2.7.egg\scrapy\selector\lxmlsel.py", >>> line 47, in select >>> raise ValueError("Invalid XPath:

Re: help with making my code more efficient

2012-12-21 Thread Dave Angel
On 12/21/2012 03:36 PM, larry.mart...@gmail.com wrote: > On Friday, December 21, 2012 10:57:19 AM UTC-7, larry@gmail.com wrote: >> >> Didn't know about bisect. Thanks. I thought it would be my savior for sure. >> But unfortunaly when I added that, it blows up with out of memory. > The out of

Re: help with making my code more efficient

2012-12-21 Thread Dave Angel
On 12/21/2012 11:47 PM, larry.mart...@gmail.com wrote: > On Friday, December 21, 2012 8:19:37 PM UTC-7, Dave Angel wrote: >> On 12/21/2012 03:36 PM, larry.mart...@gmail.com wrote: >> >>>> > I think you're misunderstanding what I need to do. I have a set of

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-22 Thread Dave Angel
On 12/22/2012 03:43 PM, prilisa...@googlemail.com wrote: > > I Think I describe my Situation wrong, the written Project is a > Server, that should store sensor data, perfoms makros on lamps > according a sequence stored in the DB and Rule systems schould > regulate home devices and plan scheduler

Re: Python, email temperature

2012-12-23 Thread Dave Angel
On 12/23/2012 08:46 AM, KarlE wrote: > On Saturday, December 22, 2012 9:36:41 PM UTC+1, KarlE wrote: >> Hi! >> >> >> >> Im totally new to Python, and im using it on my Raspberry pi. I found a >> program that sends an email, and one that checks the temperature of my CPU, >> but i cant seem to comb

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-23 Thread Dave Angel
On 12/23/2012 04:42 PM, prilisa...@googlemail.com wrote: > Okay, I try to publish this sample, and yes it's not a working piece of code, > but I try to "draw" my problem that way. As you will see, I load modules, > create cursor,... in the main.py. In the lower section you see, that the > module

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-24 Thread Dave Angel
On 12/24/2012 03:23 AM, prilisa...@googlemail.com wrote: > Hello Dave, > > Thank you, for your help, I'll try my best. > > To all others, PLEASE be pleasant with my nescience, I'll tried to describe > not a specific error at my Program. I'll tried to get rid of th

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-24 Thread Dave Angel
Python is a flexible language, but manages to let one write readable code even while using that flexibility. It does, however, require that one gets a grasp of some concepts that may differ greatly, either in implementation or in name, from other languages. Every language has its quirks and const

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-24 Thread Dave Angel
(Part 3 of my dissertation; I hope it's useful for you in particular) Up to now in my discussion, it wasn't usually important to know that everything is a class. You just know that everything has attributes, and that you use the dot notation to get at an attribute. So what if "%x".format() is

Re: Custom alphabetical sort

2012-12-24 Thread Dave Angel
On 12/24/2012 06:19 PM, Pander Musubi wrote: > > to prevent > > Traceback (most recent call last): > File "./sort.py", line 23, in > things_to_sort.sort(key=string2sortlist) > File "./sort.py", line 15, in string2sortlist > return [hashindex[s] for s in string] > KeyError: '\xc3' > >

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-25 Thread Dave Angel
On 12/25/2012 09:41 AM, prilisa...@googlemail.com wrote: > Hello Steven, > > to "learn python" I've bought a book, and it's not a "thin" one :-) it's more > a 788p. long documentation about python. > > BUT! I have to say: The autor started using the "self." argument at the > chapter classes.

Re: running gui py script

2012-12-26 Thread Dave Angel
On 12/26/2012 03:07 PM, Verde Denim wrote: > I'm learning py in this environment - > PyCrust 0.9.5 - The Flakiest Python Shell > Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) > [GCC 4.4.5] on linux2 > > When I type a tkinter program in pycrust (or pyshell), it executes as > expected, but when I

Re: Please help if you can!

2012-12-26 Thread Dave Angel
On 12/26/2012 06:04 PM, bobflipperdoo...@gmail.com wrote: > I really hope you can help! > Please use the existing thread when you're continuing to ask the same question. This mailing list has no way to delete messages. So what changes are there between the two versions of the code? Are they

Re: pickle module doens't work

2012-12-27 Thread Dave Angel
On 12/27/2012 07:05 AM, Omer Korat wrote: > You're probably right in general, for me the 3.3 and 2.7 pickles definitely > don't work the same: > > 3.3: type(pickle.dumps(1)) > > > 2.7: type(pickle.dumps(1, pickle.HIGHEST_PROTOCOL)) > That is the same. In 2.7, str is made up of bytes,

Re: learning curve

2012-12-27 Thread Dave Angel
On 12/27/2012 08:20 PM, Verde Denim wrote: > Just getting into Py coding and not understanding why this code doesn't > seem to do anything - Welcome to Python. Can I ask the obvious question? How can this be your first program? Are you just typing it in from somewhere (eg. a book, or a website)

Re: Facing issue with Python loggin logger for printing object value

2012-12-28 Thread Dave Angel
On 12/28/2012 09:27 AM, Morten Engvoldsen wrote: > Hi Team, > i am new to python Welcome. > and i am using python loggin for log the value of the > object. Below is my code : > > class field: > field_name = "" > length = 0 > type = 0 > value = "" > > def __init__(self, field_

Re: Source code of Windows installer for Python interactive interpreter

2012-12-28 Thread Dave Angel
On 12/28/2012 10:30 AM, philip.a.mol...@gmail.com wrote: > I am writing a command-line application for Windows. I would like to review > the Python source code to find out how to install my application so that it > doesn't have to be called using the path and file name (i.e. being able to > type

Re: issue with loggin

2012-12-28 Thread Dave Angel
On 12/28/2012 01:15 PM, Morten Engvoldsen wrote: > Hi Dave, > Thanks for looking into my issue. You cannot run the program since it is > in Openerp where python is used as programming language. Here python 2.7 is > used. Sorry i didn't mention all the detail. > > My progr

Re: Facing issue with Python loggin logger for printing object value

2012-12-28 Thread Dave Angel
7;) > > betfor00 = Format_betfor00() > betfor00.setValue("APPLICATION-HEADER", > applicationHeader.toString()) > betfor00.setValue("ENTERPRISE-NUMBER", enterpriseNumber) > betfor00.setValue("PRODUCTION-DATE", dateMMD

Re: Confused about logger config from within Python (3)

2012-12-28 Thread Dave Angel
On 12/28/2012 09:29 PM, andrew cooke wrote: > On Friday, 28 December 2012 21:56:46 UTC-3, Peter Otten wrote: > > reading the damn docs you condescending *? > You've made four posts this year to this forum, in two threads, to ask for help. In that same year, Peter Otten has voluntarily helpe

Re: Facing issue with Python loggin logger for printing object value

2012-12-29 Thread Dave Angel
On 12/29/2012 07:39 AM, Morten Engvoldsen wrote: > Hi Dave, > Thanks for reply. I will really appreciate if you reply to my mail id and > keep python list in cc, since everytime you reply my query i need to search > the reply in the forwarding message of python list. I won't be

Re: Facing issue with Python loggin logger for printing object value

2012-12-29 Thread Dave Angel
On 12/29/2012 11:54 AM, Morten Engvoldsen wrote: > Hi Dave, > Thanks a lot for your reply. I have used logging.setLevel(logger.DEBUG) > because of threshold as you said. > > I didn't copy paste the entire program since it was very huge. The "batch " > which value

Re: how to get the source of html in lxml?

2012-12-30 Thread Dave Angel
On 12/31/2012 01:32 AM, contro opinion wrote: > import urllibimport lxml.html > down='http://blog.sina.com.cn/s/blog_71f3890901017hof.html' > file=urllib.urlopen(down).read() > root=lxml.html.document_fromstring(file) > body=root.xpath('//div[@class="articalContent "]')[0]print > body.text_conten

Re: class problem

2012-12-30 Thread Dave Angel
On 12/31/2012 01:36 AM, contro opinion wrote: > here is my haha class You posted the same question twice before, and it was answered two hours ago. Read the first thread, instead of starting spurious ones. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list

Re: got stuck in equation

2013-01-01 Thread Dave Angel
On 01/01/2013 10:40 AM, usamazo...@gmail.com wrote: > hi . . my name is usama khan > i am the student of civil engeering and we got assignment to make a project > program on flexible pavement design using python. > > i know very litle about programing. still learning from tutorials. u can call

Re: got stuck in equation

2013-01-01 Thread Dave Angel
On 01/01/2013 11:03 AM, Chris Angelico wrote: > On Wed, Jan 2, 2013 at 2:40 AM, wrote: >> hi . . my name is usama khan >> i am the student of civil engeering and we got assignment to make a project >> program on flexible pavement design using python. >> >> i know very litle about programing. st

Re: Considering taking a hammer to the computer...

2013-01-01 Thread Dave Angel
On 01/01/2013 03:14 PM, worldsbiggestsabres...@gmail.com wrote: > OK, thank you all for your help yesterday! > > Here's where we are today (using python 3.3.0) > > He has everything running well except for the final calculations - he needs > to be able to total the number of rooms in the hotel, as

Re: Considering taking a hammer to the computer...

2013-01-01 Thread Dave Angel
On 01/01/2013 05:01 PM, Chris Angelico wrote: > On Wed, Jan 2, 2013 at 7:14 AM, wrote: >> floor_number = 0 >> for i in range(number_of_floors): >> floor_number = floor_number + 1 > Matt's already given you the part you need (and it seems to have > worked for you, yay!). Side point: Are you aw

Re: Using mktime to convert date to seconds since epoch - omitting elements from the tuple?

2013-01-02 Thread Dave Angel
On 01/02/2013 03:01 AM, Victor Hooi wrote: > Hi, > > I'm using pysvn to checkout a specific revision based on date - pysvn will > only accept a date in terms of seconds since the epoch. > > I'm attempting to use time.mktime() to convert a date (e.g. "2012-02-01) to > seconds since epoch. > > Acco

Re: why the output is different when i am implementig multiline string

2013-01-02 Thread Dave Angel
On 01/02/2013 09:00 AM, stringsat...@gmail.com wrote: '''hello > world''' > 'hello\nworld' fred=''' hello > world''' print(fred) > hello > world What you're seeing has nothing to do with the triple quotes, and everything to do with how you're using the debugger. In one case, you j

Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-02 Thread Dave Angel
On 01/02/2013 09:09 AM, someone wrote: > On 01/02/2013 01:07 PM, Peter Otten wrote: >> someone wrote: >> >>> On 01/01/2013 01:56 PM, Peter Otten wrote: >> from module import * # pylint: disable=W0622 >>> >>> Oh, I just learned something new now... How come I cannot type >>> "#pylint: >>> enabl

Re: Using mktime to convert date to seconds since epoch - omitting elements from the tuple?

2013-01-02 Thread Dave Angel
On 01/02/2013 12:34 PM, Chris Angelico wrote: > On Thu, Jan 3, 2013 at 4:27 AM, Roy Smith wrote: >> In article , >> Chris Angelico wrote: >> I assume you mean timestamps. A date doesn't need to worry about UTC the way a timestamp does. >> I'm not sure how a date and a timestamp differ

Re: avoding the accumulation of array when using loop.

2013-01-02 Thread Dave Angel
On 01/02/2013 05:21 PM, Isaac Won wrote: > Hi all, > > Thanks to Hans, I have had a good progress on my problem. > > Followings are Hans's Idea: > > import numpy as np > > b = [] > c = 4 > f = open("text.file", "r") > > while c < 10: > c = c + 1 > > > f.seek(0,0) > >

Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-02 Thread Dave Angel
On 01/02/2013 09:31 PM, someone wrote: > On 01/02/2013 08:31 PM, Ian Kelly wrote: >> On Wed, Jan 2, 2013 at 10:57 AM, Chris Angelico >> wrote: >>> Yeah, same applies to most linters I think. You end up disagreeing >>> with the author on half the points. Oh well. Doesn't make the tool >>> useless,

Re: Creating interactive command-line Python app?

2013-01-03 Thread Dave Angel
On 01/03/2013 09:24 AM, Tim Chase wrote: > (original post from planetthoughtful didn't seem to arrive here, so > replying to Bob's reply) > >> Newbie to Python, and I'm wondering if it's possible to create a >> Python console app that prompts for further input on the command >> line when run (in Wi

<    2   3   4   5   6   7   8   9   10   11   >