multiprocessing.Process call blocks other processes from running

2017-01-14 Thread Rodrick Brown
I'm trying to implement a script that tracks how much space certain applications are using and send a metric to a statsd service for realtime analysis however when running this code it nots forking multiple processes its still running sequential at some point the forking was working but I can't see

Word Order Simple.

2016-03-13 Thread Rodrick Brown
You are given nn words. Some words may repeat. For each word, output its number of occurrences. The output order should correspond with the input order of appearance of the word. See the sample input/output for clarification. *Note:* Each input line ends with a *"\n"* character. *Constraints:* 1≤

Simple exercise

2016-03-10 Thread Rodrick Brown
>From the following input 9 BANANA FRIES 12 POTATO CHIPS 30 APPLE JUICE 10 CANDY 5 APPLE JUICE 10 CANDY 5 CANDY 5 CANDY 5 POTATO CHIPS 30 I'm expecting the following output BANANA FRIES 12 POTATO CHIPS 60 APPLE JUICE 20 CANDY 20 However my code seems be returning incorrect value #!/usr/bin/env

convert to python code

2015-12-22 Thread Rodrick Brown
Tried a few things but can't seem to get it right any help ? let times = (...matrices) => matrices.reduce( ([a,b,c], [d,e,f]) => [a*d + b*e, a*e + b*f, b*e + c*f] ); -- https://mail.python.org/mailman/listinfo/python-list

iterating over strings seems to be really slow?

2014-08-27 Thread Rodrick Brown
*I'm confused why the former function runs significantly faster when wc1() builds the hash on a single pass and doesn't waste memory of returning an array of strings? * *I would think wc2() to be slower what's going on here? * #!/usr/bin/env python s = "The black cat jump over the bigger black

GO vs Python

2014-08-24 Thread Rodrick Brown
I spent a few weeks looking at Go and have to say you can see a lot of Python's influence in Go, however my question to this list for others who are doing real work with Go and Python have you encountered any scenarios in which Go outmatched Python in terms of elegance or performance? --RB -- htt

codingbat question broken?

2014-07-12 Thread Rodrick Brown
I'm working on the following problem set from codingbat.com http://codingbat.com/prob/p107863 Given 3 int values, a b c, return their sum. However, if one of the values is 13 then it does not count towards the sum and values to its right do not count. So for example, if b is 13, then both b and c

Re: SSH/Telnet program to Router/switch

2014-02-27 Thread Rodrick Brown
Sent from my iPhone > On Feb 20, 2014, at 5:59 AM, Ferrous Cranus wrote: > > Τη Τετάρτη, 19 Φεβρουαρίου 2014 10:45:53 π.μ. UTC+2, ο χρήστης Wojciech > Łysiak έγραψε: >>> On 19.02.2014 09:14, Sujith S wrote: >>> >>> Hi, >> >> >>> I am new to programming and python. I am looking for a python

Re: python

2014-02-26 Thread Rodrick Brown
L > On Feb 25, 2014, at 8:27 PM, Karthik Reddy wrote: > > Thank you, > > but from by reaserch i got these requirements .. > > Python, django, Twisted, MySQL, PyQt, PySide, xPython. > > *Technical proficiency with Python and Django. > *Technical proficiency in JavaScript. > *Experience with

Re: Telnet to remote system and format output via web page

2013-09-11 Thread Rodrick Brown
I would use something like fabric to automatically login to hosts via ssh then parse the data myself to generate static HTML pages in a document root. Having a web app execute remote commands on a server is so wrong in many ways. Sent from my iPhone On Sep 11, 2013, at 8:56 AM, Jugurtha Hadjar

Re: web development in python without using any webframework

2013-08-02 Thread Rodrick Brown
On Aug 3, 2013, at 12:37 AM, Alok Singh Mahor wrote: > Hello everyone, > few months back I started learning python and now I got nice familiarity. now > i want to use python for creating dynamic database driven websites. and I > dont want to use existing web frameworks for my work. I am learnin

Re: Buying a used iPhone 5

2013-07-10 Thread Rodrick Brown
Die On Wed, Jul 10, 2013 at 6:49 AM, oswaldclem wrote: > I'm planning on buying a used ATT iPhone 5 off of craigslist, and i've been > reading on how some people sell their iPhones to people and later on > blacklisting it, screwing the buyer over, or how people are mistakenly > buying already b

datetime.strptime() not padding 0's

2013-04-23 Thread Rodrick Brown
I thought I read some where that strptime() will pad 0's for day's for some reason this isnt working for me and I'm wondering if i'm doing something wrong. >>> from datetime import datetime >>> dt = datetime.strptime('Apr 9 2013', '%b %d %Y') >>> dt.day 9 >>> How can I get strptime to run 09? ins

Re: optomizations

2013-04-22 Thread Rodrick Brown
On Apr 22, 2013, at 11:18 PM, Dan Stromberg wrote: On Mon, Apr 22, 2013 at 6:53 PM, Roy Smith wrote: > > So, my real advice to you is to fire up the profiler and see what it > says. I agree. Fire up a line-oriented profiler and only then start trying to improve the hot spots. Got a doc o

optomizations

2013-04-22 Thread Rodrick Brown
I would like some feedback on possible solutions to make this script run faster. The system is pegged at 100% CPU and it takes a long time to complete. #!/usr/bin/env python import gzip import re import os import sys from datetime import datetime import argparse if __name__ == '__main__': p

error importing modules

2013-04-22 Thread Rodrick Brown
I'm using the fabric api (fabfile.org) I’m executing my fab script like the following: $ fab -H server set_nic_buffers -f set_nic_buffers.py Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/fabric/main.py", line 739, in main *args, **kwargs File "/usr/lib/python

The node.js Community is Quietly Changing the Face of Open Source

2013-04-16 Thread Rodrick Brown
I came across this article which sums up some of the issues I have with modern programming languages. I've never really looked at Javascript for anything serious or Node itself but I found this article really informational. "The “Batteries included” philosophy of Python was definitely the right ap

Re: New version

2013-04-09 Thread Rodrick Brown
Was it so hard to state in the email subject what the new version is or describe in the body a small summary on what you've released? I swear the users on this list post the most useless emails. Sent from my iPhone On Apr 9, 2013, at 7:12 AM, Jake D wrote: > There's a new version of im.py out o

Re: How to choose between ORMs?

2013-04-03 Thread Rodrick Brown
Pick the one you learn and know. Sent from my iPhone On Apr 3, 2013, at 2:17 AM, Alec Taylor wrote: > SQLalchemy and Storm are a few of the popular ORMs out there. > > Personally I have been using web2py's DAL. > > Other than form generator availability, 'print as raw SQL', multiple > primary k

Re: How to automatically get the indent level from code?

2013-03-16 Thread Rodrick Brown
No On Sun, Mar 17, 2013 at 12:52 AM, Peng Yu wrote: > Hi, > > I want to get the indent level within the code. For example, I want to > print 1 within the while loop as the line is indented 1 level. Is it > possible to get it within python? > > while 1: >#print the level of indent, which is

Re: Transparent Proxy and Redirecting Sockets

2013-02-21 Thread Rodrick Brown
On Thu, Feb 21, 2013 at 10:24 AM, Luca Bongiorni wrote: > Hi all, > Around I have found plenty useful sources about TCP transparent proxies. > However I am still missing how to make socket redirection. > > What I would like to do is: > > host_A <--> PROXY <--> host_B > ^ >

cafebabe python macosx easter egg?

2013-02-10 Thread Rodrick Brown
$ hexdump -n4 -C $(which python) | awk '{print $2 $3 $4 $5 }' -- http://mail.python.org/mailman/listinfo/python-list

Re: Alternatives to Splunk?

2013-02-09 Thread Rodrick Brown
On Sat, Feb 9, 2013 at 7:27 AM, sssdevelop wrote: > Are there any opensource alternatives to Splunk? > Need tool to analyze the log files.. > > This is highly off topic, however I'm using logstash + kibana for my log analysis. > -- > http://mail.python.org/mailman/listinfo/python-list > -- ht

error in except

2013-02-04 Thread Rodrick Brown
For the life of me I cant figure out why this exception is being thrown. How could I use pdb to debug this? $ python udp_local2.py server File "udp_local2.py", line 36 except: ^ SyntaxError: invalid syntax #!/usr/bin/env python import random, socket, sys s = socket.socket(socket.

Re: Python Class

2013-02-01 Thread Rodrick Brown
On Friday, February 1, 2013, Charles Hoskinson wrote: > I'm developing an online course for beginning python programmers starting > from basic syntax through object oriented design and GUI. I'd like to > include some helpful community resources like Code Academy in the appendix > and I was wonderi

Re: pyrudp

2013-01-30 Thread Rodrick Brown
On Jan 30, 2013, at 8:12 AM, Jorge Alberto Diaz Orozco wrote: > can someone give me a link to download pyrudp. > I tried here http://code.google.com/p/pyrudp/ but didn´t worked. > > if someone can give me another idea it will be great to. > I´m traying to make a reliable udp connection What abou

Re: security quirk

2013-01-29 Thread Rodrick Brown
On Tue, Jan 29, 2013 at 11:55 PM, RichD wrote: > I read Wall Street Journal, and occasionally check > articles on their Web site. It's mostly free, with some items > available to subscribers only. It seems random, which ones > they block, about 20%. > > Anywho, sometimes I use their search util

Re: Forcing Python to detect DocumentRoot

2013-01-18 Thread Rodrick Brown
On Friday, January 18, 2013, Ferrous Cranus wrote: > Τη Πέμπτη, 17 Ιανουαρίου 2013 5:14:19 μ.μ. UTC+2, ο χρήστης Joel Goldstick > έγραψε: > > On Thu, Jan 17, 2013 at 9:09 AM, Roy Smith > > wrote: > > > > In article > > <339d9d6d-b000-4cf3-8534-375e0c44b...@googlegroups.com > >, > > > > > > > > F

Re: code explanation

2013-01-14 Thread Rodrick Brown
On Mon, Jan 14, 2013 at 11:38 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Mon, 14 Jan 2013 23:00:16 -0500, Rodrick Brown wrote: > > > Can someone explain what's going on here. > > > > def _build_magic_dispatcher(method):

code explanation

2013-01-14 Thread Rodrick Brown
Can someone explain what's going on here. def _build_magic_dispatcher(method): def inner(self, *args, **kwargs): return self.__dict__[method](*args, **kwargs) inner.__name__ = method return inner Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Dependency management in Python?

2013-01-11 Thread Rodrick Brown
On Fri, Jan 11, 2013 at 5:23 PM, Adelbert Chang wrote: > Hi all, > > I've been using Python for a while now but one of my concerns is if it is > possible to have some sort of dependency management (not sure if right > term) for Python? > > In the Scala language there is the Simple Build Tool that

Re: Class confusion

2013-01-09 Thread Rodrick Brown
#x27;1039','1040'): print(sc.get_hostname(sysid).get_sysname()) On Wed, Jan 9, 2013 at 5:18 PM, Rodrick Brown wrote: > On Wed, Jan 9, 2013 at 4:34 PM, Matt Jones wrote: > >> # Something like... >> >> class SystemList(object): >>def get_systemid(sel

Re: Class confusion

2013-01-09 Thread Rodrick Brown
had no idea it was so simple. :-) > *Matt Jones* > > > On Wed, Jan 9, 2013 at 3:28 PM, MRAB wrote: > >> On 2013-01-09 20:13, Rodrick Brown wrote: >> >>> How can I make a class that has methods with attributes and other >>> functions? >>>

Class confusion

2013-01-09 Thread Rodrick Brown
How can I make a class that has methods with attributes and other functions? I see a lot of code I'm reading the documentation to Redhat's Satellite software which has a XMLRPC interface and wrote the following code to test the api. I would like to extend this code to support methods with metho

Re: how to download internet files by python ?

2013-01-07 Thread Rodrick Brown
On Mon, Jan 7, 2013 at 11:19 PM, iMath wrote: > for example ,if I want to download this file ,how to implement the > download functionality by python ? > > http://down.51voa.com/201208/se-ed-foreign-students-friends-16aug12.mp3 > > as for download speed ,of course ,the fast ,the better ,so how t

When is overriding __getattr__ is useful?

2013-01-07 Thread Rodrick Brown
Can someone provide an example why one would want to override __getattr__ and __getattribute__ in a class? -- http://mail.python.org/mailman/listinfo/python-list

Dropbox Hires Away Google’s Guido Van Rossum

2012-12-10 Thread Rodrick Brown
http://techcrunch.com/2012/12/07/dropbox-guido-van-rossum-python/ -- http://mail.python.org/mailman/listinfo/python-list

Re: stackoverflow quote on Python

2012-11-12 Thread Rodrick Brown
I believe this statement is correct given key differences do exist in underlying implementations even though such differences may be highly transparent to end users (developers). On Mon, Nov 12, 2012 at 10:08 PM, Mark Lawrence wrote: > http://stackoverflow.com/**questions/tagged/python

Re: [newbie] problem with module PyVisa

2012-11-09 Thread Rodrick Brown
It seems pretty obvious from the error. Try installing the missing lib packages. OSError: /usr/local/vxipnp/linux/bin/libvisa.so.7: cannot open shared object file: No such file or directory Sent from my iPhone On Nov 9, 2012, at 11:22 AM, Jean Dubois wrote: > OSError: /usr/local/vxipnp/linux/

Re: SSH Connection with Python

2012-10-25 Thread Rodrick Brown
On Oct 25, 2012, at 6:34 AM, Schneider wrote: > Hi Folkz, > how can i create a SSH-Connection with python? I have to send some commands > to the remote host and parse their answers. > greatz Johannes Fabric is the way to go! > -- > http://mail.python.org/mailman/listinfo/python-list -- http:/

Re: system tray or notification area in python

2012-10-16 Thread Rodrick Brown
On Oct 16, 2012, at 4:14 PM, Daniel Fetchinson wrote: > Hi folks, > > I'm using a stand alone window manager without gnome or kde or any > other de. But I still would like to have a system tray or notification > area and so far used stalonetray for this. Stalonetray is written in C > and is a GTK

Re: Executing untrusted scripts in a sandboxed environment

2012-10-06 Thread Rodrick Brown
On Oct 5, 2012, at 6:32 PM, Robin Krahl wrote: > Hi all, > > I need to execute untrusted scripts in my Python application. To avoid > security issues, I want to use a sandboxed environment. This means that the > script authors have no access to the file system. They may only access > objects,

Re: Can somebody give me an advice about what to learn?

2012-09-30 Thread Rodrick Brown
On Sun, Sep 30, 2012 at 8:58 AM, tcgo wrote: > Hi! > I'm really new to Usenet/Newsgroups, but... I'd like to learn some new > programming language, because I learnt a bit of Perl though its OOP is > ugly. So, after searching a bit, I found Python and Ruby, and both of they > are cute. > So, assum

Re: For Counter Variable

2012-09-23 Thread Rodrick Brown
On Sep 23, 2012, at 12:42 PM, jimbo1qaz wrote: > Am I missing something obvious, or do I have to manually put in a counter in > the for loops? That's a very basic request, but I couldn't find anything in > the documentation. for idx in : print (idx) i.e.. for idx in range(10): print(idx) > -

Re: technologies synergistic with Python

2012-09-21 Thread Rodrick Brown
On Sep 21, 2012, at 5:59 PM, Ethan Furman wrote: > Greetings! > > What is the consensus... okay, okay -- what are some wide ranging opinions on > technologies that I should know if my dream job is one that consists mostly > of Python, and might allow telecommuting? > > (Please don't say Java,

Re: Print Function

2012-09-21 Thread Rodrick Brown
Go away troll! Sent from my iPhone On Sep 21, 2012, at 4:27 PM, "gengyang...@gmail.com" wrote: > Hello , > > > I am currently using Python 3.2.3 . WHen I use the print function by typing > print "Game Over" , it mentions " SyntaxError : invalid syntax ". Any ideas > on what the problem is a

Re: Computing win/loss records in Python

2012-08-25 Thread Rodrick Brown
On Aug 25, 2012, at 10:22 PM, Christopher McComas wrote: > Greetings, > > I have code that I run via Django that grabs the results from various sports > from formatted text files. The script iterates over every line in the > formatted text files, finds the team in the Postgres database updates

Re: Is Python a commercial proposition ?

2012-07-29 Thread Rodrick Brown
On Jul 29, 2012, at 8:54 PM, Andrew Berg wrote: > On 7/29/2012 7:12 PM, Rodrick Brown wrote: >> Python is a glue language much like Perl was 10 years ago. Until the >> GIL is fixed I doubt anyone will seriously look at Python as an option >> for large enterprise s

Re: Is Python a commercial proposition ?

2012-07-29 Thread Rodrick Brown
Sent from my iPhone On Jul 29, 2012, at 12:07 PM, lipska the kat wrote: > Pythoners > > Firstly, thanks to those on the tutor list who answered my questions. > > I'm trying to understand where Python fits into the set of commonly > available, commercially used languages of the moment. Python i

Re: Keeping the Console Open with IDLE

2012-07-13 Thread Rodrick Brown
I think you can use pythonw.exe which will read stdin and for any input before closing. (I read this a while back, ma guy here.) Sent from my iPhone On Jul 13, 2012, at 7:27 AM, "summerholidaylearn...@gmail.com" wrote: > On Friday, February 20, 2009 4:06:42 AM UTC, W. eWatson wrote: >> I'm usi

Re: ANN: PollyReports 1.5 -- Band-oriented PDF Report Generator

2012-07-12 Thread Rodrick Brown
On Jul 11, 2012, at 8:44 PM, Simon Cropper wrote: > On 12/07/12 00:06, Chris Gonnerman wrote: >> I've held off announcing this until I was sure it was really stable; >> it's been 19 days since I made the last change to it, so here goes. >> PollyReports is my Python module for report generation. I

Re: Communication between C++ server and Python app

2012-04-28 Thread Rodrick Brown
What interfaces are available on the server process? Sent from my iPad On Apr 28, 2012, at 8:45 PM, kenk wrote: > Hi, > > I've got a server process written in C++ running on Unix machine. > On the same box I'd like to run multiple Python scripts that will > communicate with this server. > >

Re: PEP 274

2012-04-07 Thread Rodrick Brown
This proposal was suggested in 2001 and is only now being implemented. Why the extended delay? Sent from my iPhone On Apr 7, 2012, at 3:32 AM, Alec Taylor wrote: > Has been withdrawn... and implemented > > http://www.python.org/dev/peps/pep-0274/ > -- > http://mail.python.org/mailman/listin

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-28 Thread Rodrick Brown
At my current firm we hire people who are efficient in one of the following and familiar with any another C#, Java, C++, Perl, Python or Ruby. We then expect developers to quickly pick up any of the following languages we use in house which is very broad. In our source repository not including t

Re: Odd strip behavior

2012-03-22 Thread Rodrick Brown
On Mar 22, 2012, at 3:53 PM, Arnaud Delobelle wrote: > > On Mar 22, 2012 7:49 PM, "Rodrick Brown" wrote: > > > > #!/usr/bin/python > > > > def main(): > > > >str1='this is a test' > >str2='t' > > >

Odd strip behavior

2012-03-22 Thread Rodrick Brown
#!/usr/bin/python def main(): str1='this is a test' str2='t' print "".join([ c for c in str1 if c not in str2 ]) print(str1.strip(str2)) if __name__ == '__main__': main() ./remove_str.py his is a es his is a tes Why wasnt the t removed ? Sent from my iPhone -- http:/

Re: Project

2012-03-07 Thread Rodrick Brown
Pay a smart developer! Sent from my iPhone On Mar 7, 2012, at 4:46 AM, Dev Dixit wrote: > Please, tell me how to develop project on "how people intract with > social networing sites". > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-

Re: Any Advice Would Be Greatly Appreciated

2012-02-29 Thread Rodrick Brown
LinkedIn is an excellent resource for finding great candidates, However your problem might be because your searching for Python Developers why not hire great programmers and have them learn Python? Sent from my iPhone On Feb 29, 2012, at 6:08 PM, Greg Harezlak wrote: > Hello Python Community

Re: python scripts solution for euler projects

2012-02-28 Thread Rodrick Brown
On Tue, Feb 28, 2012 at 10:59 PM, scripts examples < example.scri...@gmail.com> wrote: > > Got a web site setup for solving euler problems in python, perl, > ruby and javascript. > > Feel free to give me any feedback, thanks. > > -- > http://mail.python.org/mailman/listinfo/python-list

How to handle calling functions from cli

2012-02-24 Thread Rodrick Brown
I have a bunch of sub routines that run independently to perform various system checks on my servers. I wanted to get an opinion on the following code I have about 25 independent checks and I'm adding the ability to disable certain checks that don't apply to certain hosts. m = { 'a': 'checkDis

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-11 Thread Rodrick Brown
On Fri, Feb 10, 2012 at 2:28 PM, Vinay Sajip wrote: > Sarge, a cross-platform library which wraps the subprocess module in > the standard library, has been released. > > What does it do? > > > Sarge tries to make interfacing with external programs from your > Python applications e

Re: standalone python web server

2012-02-08 Thread Rodrick Brown
On Feb 8, 2012, at 11:01 PM, Rita wrote: > I am building a small intranet website and I would like to use Python. I was > wondering if there was a easy and medium performance python based web server > available. I would like to run it on port :8080 since I wont have root access > also I prefer

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-23 Thread Rodrick Brown
On Tue, Jan 24, 2012 at 1:06 AM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Mon, 23 Jan 2012 21:57:16 -0800, Rick Johnson wrote: > > > Here is a grep from the month of September 2011 showing the rampantly > > egregious misuse of the following words and phrases: > > > > * p

Re: unzip function?

2012-01-18 Thread Rodrick Brown
On Wed, Jan 18, 2012 at 10:27 AM, Alec Taylor wrote: > http://docs.python.org/library/functions.html > >>> x = [1, 2, 3] > >>> y = [4, 5, 6] > >>> zipped = zip(x, y) > >>> zipped > [(1, 4), (2, 5), (3, 6)] > >>> x2, y2 = zip(*zipped) > >>> x == list(x2) and y == list(y2) > True > Alec can you exp

thread example question

2012-01-17 Thread Rodrick Brown
Can any idea help me figure out why the following output is sequential? I'm running this example on a 4 core system. I would expect the output to look random. import _thread as thread import time class thread_counter(object): def __init__(self, thr_cnt, sleep_int): self.thr_cnt = thr_

Re: First python project : Tuner

2012-01-17 Thread Rodrick Brown
You would get more responses if you used one of those sites that displayed the code right in the browser. On Tue, Jan 17, 2012 at 12:26 PM, Jérôme wrote: > Tue, 17 Jan 2012 08:48:13 -0800 (PST) > Rick Johnson a écrit: > > > On Jan 17, 8:16 am, Jérôme wrote: > > > > > Any comment is welcome, be

import issue with classes

2012-01-03 Thread Rodrick Brown
I have a class FooB that derives from FooA i.e. class FooB(FooA): FooA.__init__(self,...) Can someone explain why Import FooA doesn't work and I need to use from FooA import FooA instead? This puzzles me. Thanks. -- [ Rodrick R. Brown ] http://www.linkedin.com/in/rodrickbrown -- http://ma

Re: Execute a command on remote machine in python

2011-11-15 Thread Rodrick Brown
You could easily script this with popen calling secure shell to execute a command and capture the output. Sent from my iPhone On Nov 15, 2011, at 7:04 AM, Roark wrote: > Hi, > > I am first time trying my hands on python scripting and would need > some guidance from the experts on my problem

Re: PC locks up with list operations

2011-08-31 Thread Rodrick Brown
$ man limits.conf Sent from my iPhone On Aug 31, 2011, at 8:33 AM, Steven D'Aprano wrote: > Twice in a couple of weeks, I have locked up my PC by running a Python 2.5 > script that tries to create a list that is insanely too big. > > In the first case, I (stupidly) did something like: > > m

Re: Stop quoting spam [was Re: Hot Girls ...]

2011-08-19 Thread Rodrick Brown
It's not the end of the world calm down I thought it was quite funny for a friday joke! Sent from my iPhone On Aug 19, 2011, at 4:43 PM, Steven D'Aprano wrote: > Matty Sarro wrote: > >> That's great - but do they program in python? > > Thanks for that, I didn't see the spam the first time,

How to deal with optional argument evaluation

2011-05-11 Thread Rodrick Brown
I'm having a hard time dealing with the following scenario My class takes a hash like the following: rdargs = {'env:'prod','feed':'opra','hostname':'host13dkp1','process':'delta','side':'a','zone','ny'} All the keys in this hash can be optional. I'm having a hard time dealing with all 36 possibl

Re: ENVIRONMENT Variable expansion in ConfigParser

2010-10-14 Thread Rodrick Brown
How about doing something like host.name=%HOSTNAME% Then when you parse in the value %HOSTNAME% from your configParser module you do a pattern substitution of %HOSTNAME% with os.environ['HOSTNAME']. Sent from my iPhone 4. On Oct 14, 2010, at 7:57 PM, pikespeak wrote: > Hi, > I am using Conf

sending commands to the unix shell

2010-10-11 Thread Rodrick Brown
Trying to do something very trivial why is it failing I've tried three approaches 1. os.system("/bin/cat %s | /bin/mail -s \'connection error\' %s" % (logFile,notifyList)) 2. os.system("/bin/mail -s \'connection error\' %s < %s" % (notifyList,logFile)) 3. p1 = sp.Popen(["/bin/cat", log

How do you preserve time values with date.datefromtimestamp()

2010-09-15 Thread Rodrick Brown
I'm doing something like >>> today = datetime.date.fromtimestamp(1284584357.241863) >>> today.ctime() 'Wed Sep 15 00:00:00 2010' Why isn't the time field being populated what I expect is to see something like Wed Sep 15 2010 16:59:17:241863 -- [ Rodrick R. Brown ] http://www.rodrickbrown.com ht

Re: WMI in Python

2010-09-13 Thread Rodrick Brown
The easiest way to do this is to use the native OS tools readily available to do the collection and log to a central location or if possible shared location accessible by all systems, once you have all the data you want to feed into your RDBMS you could easily parse these logs using python and t

0 length field in time string

2010-08-17 Thread Rodrick Brown
Anyone know why I'm getting the following error when trying to parse the following string is there a better method to use? #57=2010081708240065 - sample string passed to fmt_datetime def fmt_datetime(tag57): tag57 = tag57[3:len(tag57)] year= int ( tag57[0:4] ) mon = int (

Open a command pipe for reading

2010-08-17 Thread Rodrick Brown
I have a fairly large file 1-2GB in size that I need to process line by line but I first need to convert the file to text using a 3rd party tool that prints the records also line by line. I've tried using Popen to do this with no luck. I'm trying to simulate /bin/foo myfile.dat And as the re

Re: measuring a function time

2010-07-29 Thread Rodrick Brown
Someone should port Perl's Benchmark.pm module to python that's such a useful module to measure a functions execution time and CPU usage. Sent from my iPhone 4. On Jul 29, 2010, at 3:43 PM, "Benjamin J. Racine" wrote: > I just use ipython's functions (that are themselves just calls to the tim

Re: Multiline regex

2010-07-21 Thread Rodrick Brown
Slurp the entire file into a string and pick out the fields you need. Sent from my iPhone 4. On Jul 21, 2010, at 10:42 AM, Brandon Harris wrote: > I'm trying to read in and parse an ascii type file that contains information > that can span several lines. > Example: > > createNode animCurveTU

Re: Help with movie module

2010-07-06 Thread Rodrick Brown
Did you try emailing the author of this application? 2010/7/6 Jose Ángel Quintanar Morales > Hi, I'm sorry by my bad english. > > I have a little problem with pygame.movie module when I try work whit him > show this problem > > [josean...@qumax reproductor]$ python packbox.py > packbox.py:64: Ru

Re: pprint

2010-06-09 Thread Rodrick Brown
On Wed, Jun 9, 2010 at 5:01 AM, madhuri vio wrote: > sir what is the function of pprint??? > could you please help me out with that > > -- > madhuri :) > > rbr...@laptop:~$ python Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15) [GCC 4.4.1] on linux2 Type "help", "copyright", "credits" or "licens

Re: Programing family

2010-02-09 Thread rodrick brown
Don't forget his little brother Go! Sent from my iPhone 3GS. On Feb 8, 2010, at 8:39 PM, AON LAZIO wrote: I have thought funny things If we think all languages are like a family I could draft them like this (Python base) C is Python's Mom C++ : Dad Pascal/Assembly : Grandparents C# : Uncle

Re: Do I have to use threads?

2010-01-05 Thread Rodrick Brown
On Tue, Jan 5, 2010 at 11:26 PM, aditya shukla wrote: > Hello people, > > I have 5 directories corresponding 5 different urls .I want to download > images from those urls and place them in the respective directories.I have > to extract the contents and download them simultaneously.I can extract t

Re: Question about an application

2010-01-03 Thread rodrick brown
Take a look at ssh Sent from my iPhone 3GS. On Jan 4, 2010, at 12:50 AM, rieh25 wrote: I am thinking of installing a python webserver I coded in every computer at my work. This would allow me to run specific tasks in them, like creating backups, installing things, etc. Is there another w

Thread performance on Python 2.6

2009-12-30 Thread Rodrick Brown
I started dabbling with threads in python and for some odd reason the performance seems extremely poor on my 2 core system. It this a simplified version spawn 2 threads write some data to a file and time the results vs doing the same sequentially. Why is the performance so much slower with the thre

Re: Author of a Python Success Story Needs a Job!

2009-12-28 Thread Rodrick Brown
Move to NYC, Chicago, or Boston and try to land a job working in the financial industry they're always hiring and Python is getting very popular amongst the quantitative and computation finance sectors. You may need to use head hunters two I recommended are Connections NY, Open Systems, and Tek Sy

Queues vs List

2009-12-25 Thread Rodrick Brown
Was reading the official python document and I noticed they mentioned queues being more efficient for adding/removing elements vs list so I wrote a quick test the validate this claim and I wasn't very impressed by the results it seems queues are just slightly faster so my question to the list, is d

Testing for empty list

2009-12-24 Thread Rodrick Brown
>>> p=[] >>> if p is None: ... print 'yes' ... >>> This doesn't work as expected. -- [ Rodrick R. Brown ] http://www.rodrickbrown.com http://www.linkedin.com/in/rodrickbrown -- http://mail.python.org/mailman/listinfo/python-list