Help me with a bytes decoding problem in python 3

2012-06-21 Thread J
I have a bit of a problem I hope you could help me sort out with some code I'm porting from 2.x to 3. I have a program with a wrapper for Popen that is called to run certain linux shell commands and gather system info. Essentially the code looks something like this: process = subprocess.Popen(

Re: Help me with a bytes decoding problem in python 3

2012-06-21 Thread J
On Thu, Jun 21, 2012 at 5:54 PM, Chris Angelico wrote: > On Fri, Jun 22, 2012 at 7:47 AM, J wrote: >> \xe2\x86\xb3 > > This is the UTF-8 encoded form of U+21B3, which is the DOWNWARDS ARROW > WITH TIP RIGHTWARDS character that you're showing. That's what the > &

Frustrating circular bytes issue

2012-06-26 Thread J
This is driving me batty... more enjoyment with the Python3 "Everything must be bytes" thing... sigh... I have a file that contains a class used by other scripts. The class is fed either a file, or a stream of output from another command, then interprets that output and returns a set that the main

Flushing buffer on file copy on linux

2012-08-14 Thread J
I was hoping someone could give me some ideas for a particular problem. I've got a python program that is used for basic testing of removable storage devices (usb, mmc, firewire, etc). Essentially, it looks for a mounted device (either user specified, or if not, the program loops through all remo

Is there a way to create kernel log messages via Python?

2012-10-15 Thread J
Hi... I have a bit of code that does the following: uses the syslog module to inject a LOG_INFO message into the syslog on my linux machine runs a suspend/resume cycle uses the syslog module to inkect a LOG_INFO message marking the end of test. Then I parse everything between the start and stop

Is there a more elegant way to handle determing fail status?

2013-01-15 Thread J
Ok, so I have a diagnostic tool, written by someone else. That tool runs a series of small tests defined by the user and can simplified summary output that can be one of the following: FAILED_CRITICAL FAILED_HIGH FAILED_MEDIUM FAILED_LOW PASSED I also have a wrapper script I wrote to run these te

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

2012-01-24 Thread J
On Tue, Jan 24, 2012 at 09:05, Martin P. Hellwig wrote: > On 24/01/2012 05:57, Rick Johnson wrote: > > I would wish that pedantic citizens of the British colony in America stopped > calling whatever misinterpreted waffle they produce, English. I, sir, as a citizen of that FORMER British colony h

Help me with weird logging problem

2012-03-06 Thread J
Hi, I'm trying to add a couple log handlers to a program. The end goal is to log things at INFO or above to console, and if a -v option is set to ALSO log everything at DEBUG or above to a file. However, while I DO get the log file created, and log messages are appearing there, Debug messages ar

Re: Help me with weird logging problem

2012-03-06 Thread J
On Tue, Mar 6, 2012 at 11:19, Vinay Sajip wrote: > On Mar 6, 4:09 pm, J wrote: >> >> Any idea what I'm doing wrong? > > Levels can be set on loggers as well as handlers, and you're only > setting levels on the handlers. The default level on the root logger >

Re: tee-like behavior in Python

2012-05-09 Thread J
On Wed, May 9, 2012 at 11:35 AM, Florian Lindner wrote: > Hello, > > how can I achieve a behavior like tee in Python? > > * execute an application > * leave the output to stdout and stderr untouched > * but capture both and save it to a file (resp. file-like object) > > I have this code > > proc =

How to iterate through two dicts efficiently

2011-07-19 Thread J
Hello, I am looking to improve the performance of the following piece of Python code:- for cc in StatusContainer: for srv in StatusContainer[cc]: for id in StatusContainer[cc][srv]['RECV']: if id in StageContainer['13']:

Re: How to iterate through two dicts efficiently

2011-07-19 Thread J
Hi guys, Thank you for your suggestions. I have managed to get my whole script to execute in under 10 seconds by changing the 'for loop' I posted above to the following:- for opco in Cn: for service in Cn[opco]: ack = set(Cn[opco][service]['RECV']) & set(Pr['13'])

UnicodeEncodeError -- 'character maps to '

2011-08-27 Thread J
d this but haven't really found any way to overcome the error. Any ideas? J -- http://mail.python.org/mailman/listinfo/python-list

Convert AWK regex to Python

2011-05-16 Thread J
Good morning all, Wondering if you could please help me with the following query:- I have just started learning Python last weekend after a colleague of mine showed me how to dramatically cut the time a Bash script takes to execute by re-writing it in Python. I was amazed at how fast it ran. I

Re: Convert AWK regex to Python

2011-05-16 Thread J
Good morning Angelico, Do I understand correctly? Do you mean incorporating a Python dict inside the AWK command? How can I do this? -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert AWK regex to Python

2011-05-16 Thread J
Hello Peter, Angelico, Ok lets see, My aim is to filter out several fields from a log file and write them to a new log file. The current log file, as I mentioned previously, has thousands of lines like this:- 2011-05-16 09:46:22,361 [Thread-4847133] PDU D All the lines in the log file are sim

Re: Convert AWK regex to Python

2011-05-16 Thread J
Thanks for the sugestions Peter, I will give them a try Peter Otten wrote: > J wrote: > > > Hello Peter, Angelico, > > > > Ok lets see, My aim is to filter out several fields from a log file and > > write them to a new log file. The current log file, as I mentioned

Re: Convert AWK regex to Python

2011-05-17 Thread J
Hello, I have managed to get my script finished in the end by taking bits from everyone who answered. Thank you so much. the finished query string looks like this (still not the best but it gets the job done. Once I learn to code more with Python I will probably go back to it and re-write it

packaging python

2005-09-24 Thread J
Hi everyone, I managed to package python for distribution with my app. I made 'dist' using py2exe and everything runs fine except there is no more output from the python interpreter. I redirect the output like so... static PyMethodDef ioMethods[] = { {"output", output, METH_VARARGS, "output"}

reference count

2005-09-28 Thread J
Hi, I have a problem with the reference count after an error occurs in a script which I execute as follows.. PyObject* lDict = PyDict_New(); PyDict_SetItemString(lDict, "item", (PyObject*)iItem->mPyObject); PyObject* lResult = PyEval_EvalCode(mCode, ScnGlobal::sDictionary, lDict); if (! lResult)

Re: reference count

2005-09-28 Thread J
I tend to answer my own questions a lot. But he, lets grow the knowledge base :)... PyErr_Clear() after PyErr_Print did the trick J -- http://mail.python.org/mailman/listinfo/python-list

VC++ linking problem

2005-07-07 Thread J
Hi everyone, I started embedding python into a 3D graphics App and I came across this linking problem. SO.lib(ScnGlobal.obj) : error LNK2001: unresolved external symbol __imp__Py_InitModule4TraceRefs SO.lib(ScnNode.obj) : error LNK2001: unresolved external symbol __imp___Py_RefTotal SO.lib(ScnLi

Re: VC++ linking problem

2005-07-07 Thread J
Thank you very much Miki! That was an easy solution. It links... I will put a hold on compiling the latest version until I really have to. I will probably switch to VC 7 before that. Cheers Jochen Miki Tebeka wrote: > Hello Jochen, > > > I started embedding python into a 3D graphics App and I c

publishing an already instantiated class

2005-07-07 Thread J
Hi everyone, Thanks for your awsome replies. I started replacing Javascript with python 2 days ago and I already have my first scripts running. Mainly due to the wealth of information in this blog. I have a C++ object that is already instantiated and now I want to give python a reference to it...

Re: publishing an already instantiated class

2005-07-07 Thread J
I think I just found my own solution, so I will record it for future references I did this in my Constructor of X { PyStruct* lObject; lObject = PyObject_New(PyStruct, &X::PyType); lObject->mObject = this; } What does everyone think about this. I am posting a little bit out of the hip

embedding a new method

2005-07-08 Thread J
Hi everyone, I am fairly new to python (3rd day), but i am fairly keen on replacing javascript. I want to externalize some of the mehtod in my App, an allow user to imp char* lBuffer = "def handler(color):\n" " print 12" PyObject* lCode = Py_CompileString(lBuffer, ""

Re: embedding a new method

2005-07-08 Thread J
If your are reading this, I am sorry but I forgot to finish the first paragraph :(. I am trying to externalize some methods of a C++ object using python. User will be able to implement the function via the GUI and I then would like to add it to an instance... So the class consits of both python

linking problem

2005-07-08 Thread J
Hi everyone, I thought that I would compile the python debug library and step through it to figure out where things fail. So, I downloaded python 2.4.1 and compile the python24_d.lib using the dsp files in PCBuild. It compiles fine whitout a problem, but when I link agains it i get a unresolved ex

inheritance

2005-07-10 Thread J
Hi I am trying to make a C++ class hierarchy accessible to python scripts. Am I right to assume that the type structure of a derived class must have all the members of its base class declared as well ? For example, typedef struct { PyObject_HEAD int someb

Re: inheritance

2005-07-10 Thread J
just to follow up. I managed to get it working by having a closer look at the xxmodules. However, the example does the following typedef struct { PyStructBaseClass mBase; int mValue; } PyStructDerivedClass; Does anything speak agains doing this ?

Adding and attribute to an instance

2005-08-09 Thread J
Hi, I am trying to add new data attributes to my extension classes from within a script. I am under the impression that python allows that implicity This is the definition of my class PyTypeObject CmdPlace::PyType = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/

packaging python for install.

2005-09-11 Thread J
Hi everyone, I have created an App that embedds the python interpreter and I am now in the process of creating an installer. I am currently linking python24.lib, but it is only 184k and I suspect that it imports other dlls... I am also using numarray. Does anyone have any experiences in packaging

Re: packaging python for install.

2005-09-12 Thread J
Hi Miki Thx for you reply. I have tried the procedure but I am stuck with python setup.py py2exe --includes mymodule. I get the following error: "ImportError: No module named mymodule" I don't know what mymodule should contain. Basically I want all of python and numarray to be part of the distr

packaging python for install.

2005-09-14 Thread J
Hi everyone, I have posted a question on this topic before and already received some useful advice. I am basically trying to package python with an App that embedds the interpretor. I am also including numarray (i.e. I have a #include in my C++ code). However it looks like I have problems with

Re: packaging python for install.

2005-09-14 Thread J
Hi I found the solution to problem and I just want to document it for the next guy. I did not copy the content of the 'dist' directory created by Py2exe to the folder containing my executable. Changing HKEY_LOCAL_MACHINE\SOFTWARE\PythonCore\. alone did not work for me... maybe I should have foun

A bit of a boggle about subprocess.poll() and the codes it receives from a process

2011-09-09 Thread J
Hi, I need a bit of help sorting this out... I have a memory test script that is a bit of compiled C. The test itself can only ever return a 0 or 1 exit code, this is explicitly coded and there are no other options. I also have a wrapper test script that calls the C program that should also onl

Embedding a "frame" into a movie using python

2011-10-12 Thread J
programs allow you to do. Is there a way I can do this with python? Cheers, J -- http://mail.python.org/mailman/listinfo/python-list

Re: Embedding a "frame" into a movie using python

2011-10-13 Thread J
ps I can hack it to work on the back of appengine... Cheers, J -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I pass a variable to os.popen?

2011-10-31 Thread J
On Mon, Oct 31, 2011 at 16:16, extraspecialbitter wrote: >    if line[10:20] == "Link encap": >       interface=line[:9] >    cmd = 'ethtool %interface' >    print cmd >    gp = os.popen(cmd) because you're saying that cmd is 'ethtool %interface' as you pointed out later on... how about: cmd =

Is there a way to merge two XML files via Python?

2012-01-12 Thread J
This is more a theory exercise and something I'm trying to figure out, and this is NOT a homework assignment... I'm trying to make a tool I use at work more efficient :) So this is at test tool that generates an XML file as it's output that is eventually used by a web service to display test resu

question about try/except blocks

2013-05-02 Thread J
I have this function in a class: def write_file(self, data, dest): with open(dest, 'wb', 0) as outfile: try: print("IN WRITE_FILE") outfile.write(self.data) except IOError as exc: logging.error("Unable to write data t

Numarray, numeric, NumPy, scpy_core ??!!

2006-01-20 Thread J
Hi I hope the title of this message indicates my question. I am looking for basic array functionality in Python and it turns out that there are all these packages which are somehow related. Some are allegedly discontinued but still seem to get updated. Could we start a discussion about which packa

Re: Numarray, numeric, NumPy, scpy_core ??!!

2006-01-21 Thread J
Ok, I will look at NumPy ... I have another question about performance. Are the array operations such as matrix multiplication implemented in python or in C ? I was under the impression that the function calls in numarray are only wrappers to C code, but now I suspect that matrix multiplicaiton is

Re: Numarray, numeric, NumPy, scpy_core ??!!

2006-01-21 Thread J
I will just jump in an use NumPy. I hope this one will stick and evolve into the mother of array packages. How stable is it ? For now I really just need basic linear algebra. i.e. matrix multiplication, dot, cross etc Cheers -- http://mail.python.org/mailman/listinfo/python-list

NewB: Glob Question

2007-05-03 Thread J
Greetings Group- I'm trying to put together a pattern matching script that scans a directory tree for tif images contained in similar folder names, but running into a NewB problem already. Is it the way I'm trying to join multiple paths? Any help would be greatly appericated. Thanks,

Matching Directory Names and Grouping Them

2007-01-11 Thread J
found code that can do the trick. Any help would be greatly appreciated. Thanks! J. -- http://mail.python.org/mailman/listinfo/python-list

Re: Matching Directory Names and Grouping Them

2007-01-11 Thread J
umber representing year and a subdirectory name containing a two digit number representing a month. The matches are grouped together and written into a text file. I hope this helps. Kind Regards, J Steve Holden wrote: > J wrote: > > Hello Group- > > > > I have limited progr

Python Module: nift

2009-02-08 Thread J
What are your thoughts on this module I created? ''' A Python Module created by a High School Student. Includes rev(), reet(), and leet(). Import nift Function: nift.rev() Description:Reverses a string Usage: nift.rev('string')

Re: Python Module: nift

2009-02-08 Thread J
Thanks for your answers, especially Chris Rebert and Paul McGuire's. I have a question: How far does Python go in the Game Development field? (Using Python only, no extensions) -- http://mail.python.org/mailman/listinfo/python-list

Email Program

2009-02-28 Thread J
Is it possible to make a GUI email program in Python that stores emails, composes, ect? -- http://mail.python.org/mailman/listinfo/python-list

Email Program

2009-02-28 Thread J
Is it possible to make a GUI email program in Python that stores emails, composes, ect? Also, could I create my own programming language in Python? What are Pythons limits, or is this just a waste of my time to learn it. -- http://mail.python.org/mailman/listinfo/python-list

Question about xml.com

2009-03-10 Thread J
] and commandlet.childNodes[2] empty? Thanks in advance! J >>> print xmldoc.firstChild.toxml() 0.1 Beta test just a test somebody linux2 0 3.19 >>> commandlet=xmldoc.firstChild >>> print commandlet.firstChild.toxml() >>> print co

SimpleXMLRPCServer and creating a new object on for each new client request.

2009-05-06 Thread J
Hi list, My goals is to have concurrent and separated client sessions using xmlrpc. Initially my though was that SimpleXMLRPCServer was able to create a new object instance for each incoming request. But this doesn't appear to be the case, unless I'm overlooking something, if so please point me ou

slightly OT: Python BootCamp

2009-11-28 Thread J
d OO programming, just not as proficient as I would like to be... Cheers Jeff -- Jonathan Swift - "May you live every day of your life." - http://www.brainyquote.com/quotes/authors/j/jonathan_swift.html -- http://mail.python.org/mailman/listinfo/python-list

Re: slightly OT: Python BootCamp

2009-11-29 Thread J
On Sun, Nov 29, 2009 at 03:57, Carl Banks wrote: > On Nov 28, 6:15 pm, J wrote: >> http://www.otg-nc.com/python-bootcamp >> >> It's a week long Python Bootcamp. > > > I'm surprised they're able to fill out 5 days with intensive training > on P

Question about file objects...

2009-12-02 Thread J
Something that came up in class... when you are pulling data from a file using f.next(), the file is read one line at a time. What was explained to us is that Python iterates the file based on a carriage return as the delimiter. But what if you have a file that has one line of text, but that one

Re: Question about file objects...

2009-12-02 Thread J
On Wed, Dec 2, 2009 at 09:27, nn wrote: >> Is there a way to read the file, one item at a time, delimited by >> commas WITHOUT having to read all 16,000 items from that one line, >> then split them out into a list or dictionary?? > File iteration is a convenience since it is the most common case.

Re: slightly OT: Python BootCamp

2009-12-03 Thread J
On Sun, Nov 29, 2009 at 20:14, Terry Reedy wrote: > J wrote: >> >> Ok... so I've been re-teaching myself python, as it's been several >> years since I last really used it.  And in the midst of this, my >> contracting company came up to me on Friday and asked

Re: slightly OT: Python BootCamp

2009-12-03 Thread J
On Fri, Dec 4, 2009 at 09:21, Steven D'Aprano wrote: > On Thu, 03 Dec 2009 16:20:24 -0500, J wrote: > >> The difference between me (learning a new language) and the guy teaching >> (who knows it inside and out) > > I don't know about that. He's teaching so

Re: Why Can't I Delete a File I Created with Win XP?

2009-12-05 Thread J
On Sat, Dec 5, 2009 at 17:42, John Machin wrote: > On Dec 6, 2:46 am, "W. eWatson" wrote: >> However, even at >> that, why can't I delete this empty file called Analysis? > > Are you trying to delete the file from another command window while > Python is paused at the interactive prompt? In any c

Re: Why Can't I Delete a File I Created with Win XP?

2009-12-05 Thread J
On Sat, Dec 5, 2009 at 20:32, J wrote: > connections eventually.  So being able to find who has a lock on a > given file or directory if the program dies unexpectedly would be > useful. Google tells me that the program Process Explorer from SysInternals will provide most of the functio

Re: Why Can't I Delete a File I Created with Win XP?

2009-12-05 Thread J
On Sat, Dec 5, 2009 at 21:14, W. eWatson wrote: > What I'm trying to do is really simple. In the Win XP NG, I have two > suggestions to get rid of the Analysis folder and the empty file in it. One > is to use a program like you suggested, and the other is to delete it from > DOS. I just tried cmd

Re: Why Can't I Delete a File I Created with Win XP?

2009-12-05 Thread J
On Sat, Dec 5, 2009 at 23:17, W. eWatson wrote: > J wrote: >> And those are your only options, really.  From what I've been able to >> see, there is no native ability in Linux to actually see who has a >> lock on a file that's been opened.  And I completely unders

question about imports in a class

2009-12-07 Thread J
Just a little newbie confusion about OS imports... Why does this give me an error: class Windows: def __init__(self): ''' Constructor ''' import os self.dmidecodePath="" #final path to dmidecode binary def parseDMI(self): # First, find dmi

Re: question about imports in a class

2009-12-07 Thread J
On Mon, Dec 7, 2009 at 16:13, J wrote: > But why does importing in the init not make os available to every > other function in the class?  Do I have to import OS into every > function like this: > > class ClassA(): > >    def func1(self): >        import

Re: question about imports in a class

2009-12-07 Thread J
On Mon, Dec 7, 2009 at 16:57, Diez B. Roggisch wrote: >> if I put the import at the beginning of the class, it just dawned on >> me that perhaps I still have to explicitly call the function by class: >> >> sysinfo.py >> >> class myclass(): >>    import os >>    def findDMIDecode(self): >>        

Problem using commands.getoutput()

2009-12-08 Thread J
indows? I can do what I want, I think, by using os.popen(), but I wanted to know if there was a better way of doing it. Cheers, Jeff -- Jonathan Swift - "May you live every day of your life." - http://www.brainyquote.com/quotes/authors/j/jonathan_swift.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem using commands.getoutput()

2009-12-08 Thread J
On Tue, Dec 8, 2009 at 14:44, Jerry Hill wrote: > At the very top of http://docs.python.org/library/commands.html it > says "Platforms: Unix", so yes, it's Unix-only. That sound you hear is me beating my head against the table now... sigh... I was too wrapped up in reading the actual code to not

Help with parsing a list

2009-12-16 Thread J
Hi all, I need some help in turning a list into a dictionary... The list looks something like this: ['key1: data1','key2: data2','key3: data3',' key4: ',' \tdata4.1',' \tdata4.2',' \tdata4.3','key5: data5'] and it's derived from output (via subprocess.Popen) that in a terminal would look like t

Thanks for the help not given :)

2009-12-29 Thread J
I just wanted to take a break from writing some code to thank the list for all the help you've NOT given me :-) And I do mean that but I should explain... At least three times today, I've been working on various bits of code, and run into a problem that I just could not figure out. And each

Re: Thanks for the help not given :)

2009-12-29 Thread J
try the teddy bear approach, but the last one I knew led me down the dark path to Perl and thus I try to avoid them whenever possible ;-) Cheers, Jeff -- Jonathan Swift - "May you live every day of your life." - http://www.brainyquote.com/quotes/authors/j/jonathan_swift.html -- http://mail.python.org/mailman/listinfo/python-list

Re: multivariable assignment

2009-12-31 Thread J
and created three pointers to it. Though I wondered something similar the other day... obviously this won't work: a,b,c = [] but does this do it properly: a,b,c = [],[],[] For now, in my newbieness, I've been just creating each one separately: a=[] b=[] c=[] Cheers, Jeff -- Jonathan Swift - "May you live every day of your life." - http://www.brainyquote.com/quotes/authors/j/jonathan_swift.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Python books, literature etc

2010-01-06 Thread J
On Wed, Jan 6, 2010 at 09:35, Shawn Milochik wrote: > Search Google. You'll find it all. > > Search this list's archives. This kind of thing has been discussed a thousand > times. > > It also wouldn't hurt to brush up on this: > http://catb.org/~esr/faqs/smart-questions.html Heh... I've seen tha

Re: Python books, literature etc

2010-01-06 Thread J
A good point was brought up to me privately, and I agree completely, that the OP should re-state the request with a bit more specifics... Since the OP says he is at least familiar with Python, does he need info on beginner level books that are general purpose, or is he interested in resources that

Re: Scripting (was Re: Python books, literature etc)

2010-01-08 Thread J
On Fri, Jan 8, 2010 at 09:37, Jorgen Grahn wrote: > Regarding the book's title: is it just me, or are Python programmers > in general put off when people call it "scripting"? > > I won't attempt a strict definition of the term "scripting language", > but it seems like non-programmers use it to mea

Re: table from csv file

2010-01-08 Thread J
On Fri, Jan 8, 2010 at 13:55, Jon Clements wrote: > On Jan 8, 5:59 pm, marlowe wrote: >> I am trying to create a table in python from a csv file where I input >> which columns I would like to see, and the table only shows those >> columns. I have attached an example of the csv file i am using, an

Re: table from csv file

2010-01-09 Thread J
On Sat, Jan 9, 2010 at 05:26, Jon Clements wrote: >> reader = open('C:/test.txt','rb') >> data = csv.DictReader(reader,restval='000',restkey='Misc') > > [snip] > > DictReader works, but what use to bug me was the fact you couldn't > then output the cols in the 'correct' order afterwards, so you h

Re: What is built-in method sub

2010-01-11 Thread J
On Mon, Jan 11, 2010 at 15:02, Jeremy wrote: > I am using the re.sub command to remove trailing whitespace from lines > in a text file.  The commands I use are copied below.  If you have any > suggestions on how they could be improved, I would love to know. Just curious, but if each line is simpl

Re: Inheriting methods but over-riding docstrings

2010-01-17 Thread J
On Sun, Jan 17, 2010 at 19:45, Alf P. Steinbach wrote: > Steven: on a personal note, earlier when I saw you (I think it was you) > using the "Norwegian Parrot" example I thought it referred to me because > that was the only sense I could make of it, it followed right after some > discussion we had

Re: not and is not problem

2010-01-18 Thread J
1875840 >> name = "bar" >> id(name) 11875744 >> id(name1) 11875840 >> id("foo") 11875840 >> id("bar") 11875744 shows the location for each object in relation to the name pointing to that object... -- Joan Crawford - "I, Joan Crawford, I believe in the dollar. Everything I earn, I spend." - http://www.brainyquote.com/quotes/authors/j/joan_crawford.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Good Book

2010-01-28 Thread J
On Thu, Jan 28, 2010 at 11:09, talal awadh wrote: > Many people who want to learn Islam or are new converts find it hard I just wanted to thank you for reminding me that I needed to write a mail filter to delete this kind of drivel. I appreciate the reminder! Cheers, Jeff -- http://mail.pytho

Re: What is Islam?-1

2009-10-13 Thread J
On Tue, Oct 13, 2009 at 20:05, Aahz wrote: There's no point in trying to reason with a Muslim. >>> >>> That's not funny, and if you were being serious, that was incredibly >>> rude. >> >>Not as much as posting in comp.lang.python. > > What exactly are you claiming is rude? This entire thread

A stupid newbie question about output...

2009-10-20 Thread J
Can someone explain why this code results in two different outputs? > for os in comp.CIM_OperatingSystem (): > print os.Name.split("|")[0] + " Service Pack", os.ServicePackMajorVersion > osVer = os.Name.split("|")[0] + " Service Pack", os.ServicePackMajorVersion > print osVer the first print s

Re: A stupid newbie question about output...

2009-10-20 Thread J
On Tue, Oct 20, 2009 at 14:53, Ethan Furman wrote: > osVer = "%s Service Pack %d" % (os.Name.split("|")[0], >        os.ServicePackMajorVersion) > > This way, osVer is a string, and not a tuple. Thanks for the help... The tuple thing is a new concept to me... at least the vocabulary is, I'll go

Re: A stupid newbie question about output...

2009-10-20 Thread J
On Tue, Oct 20, 2009 at 16:25, Aahz wrote: > In article , > J   wrote: >> >>The tuple thing is a new concept to me... at least the vocabulary is, >>I'll go look that up now and learn info on tuples. It's been ages >>since I did any python programming, a

Re: Beginning Question about Python functions, parameters...

2009-11-23 Thread j
On Nov 23, 12:37 pm, Neo wrote: > astral orange schrieb: > > > > > Hi, I am trying to teach myself Python and have a good book to help me > > but I am stuck on something and I would like for someone to explain > > the following piece of code for me and what it's actually doing. > > Certain parts a

Ideas for creating processes

2010-03-10 Thread J
I'm working on a project and thought I'd ask for a suggestion on how to proceed (I've got my own ideas, but I wanted to see if I was on the right track) For now, I've got this: def main(): ## get our list of directories to refresh releases=sys.argv[1:] if len(releases) < 1: print

Re: Ideas for creating processes

2010-03-10 Thread J
On Wed, Mar 10, 2010 at 16:52, J wrote: > the quick and dirty would be (as I'm imagining it at the moment): > for path in pathlist: >    chdir into path >    execute rsync or zsync > > but that gets me moving into one dir, updating, then moving into another. > > What

Re: Ideas for creating processes

2010-03-10 Thread J
On Wed, Mar 10, 2010 at 18:03, MRAB wrote: > Are you sure that you would gain from doing more than one at a time? > > The bottleneck will probably be the speed of your network connection, > and if that's working at its maximum speed with one sync then doing > several concurrently won't save any ti

Get Eclipse/PyDev to run scripts that don't end in .py

2010-03-31 Thread J
Is there any way to tell PyDev in Eclipse to run a script that doesn't end in .py? Even if I have to go and manually set something for each file... I've inherited (in a manner of speaking) a dev project that is done in python2.6... I pulled the latest dev branch and have it opened as a project in

Regex driving me crazy...

2010-04-07 Thread J
Can someone make me un-crazy? I have a bit of code that right now, looks like this: status = getoutput('smartctl -l selftest /dev/sda').splitlines()[6] status = re.sub(' (?= )(?=([^"]*"[^"]*")*[^"]*$)', ":",status) print status Basically, it pulls the first actual line of data fr

Re: Regex driving me crazy...

2010-04-07 Thread J
On Wed, Apr 7, 2010 at 22:45, Patrick Maupin wrote: > When I saw "And I am interested in the string that appears in the > third column, which changes as the test runs and then completes" I > assumed that, not only could that string change, but so could the one > before it. > > I guess my base ass

Re: Regex driving me crazy...

2010-04-08 Thread J
On Thu, Apr 8, 2010 at 01:16, Kushal Kumaran wrote: > > Is there any particular reason you absolutely must extract the status > message?  If you already have a list of possible status messages, you > could just test which one of those is present in the line... Yes and no... Mostly, it's for the

question about list extension

2010-04-16 Thread J
Ok... I know pretty much how .extend works on a list... basically it just tacks the second list to the first list... like so: >>> lista=[1] >>> listb=[2,3] >>> lista.extend(listb) >>> print lista; [1, 2, 3] what I'm confused on is why this returns None: >>> lista=[1] >>> listb=[2,3] >>> print li

Re: question about list extension

2010-04-16 Thread J
On Fri, Apr 16, 2010 at 15:16, Terry Reedy wrote: > On 4/16/2010 9:41 AM, J wrote: >> >> Ok... I know pretty much how .extend works on a list... basically it >> just tacks the second list to the first list... like so: >> >>>>> lista=[1] >>>&

Is it better to extend a class, or do something repetitious in the main part of a program?

2010-04-19 Thread J
First, before I get farther, Is there a way for the logging module to natively handle lists and dict objects when logging? e.g. take this {'key1':'val1','key2':'val2'} and have it logged like this: INFO: key1: val1 INFO: key2: val2 If I pass the dict or list directly to the logger, it is logged

Difference between Popen and open() for reading a file

2010-04-22 Thread J
I was reading something from a code review a little while ago and saw something that's got my curiosity up... Say I had a file, foo.txt that I wanted to read from, only one time and only read. So what's the difference between this: mylist = Popen(["cat","foo.txt"], stdout=PIPE).communicate()[0].

Re: Difference between Popen and open() for reading a file

2010-04-22 Thread J
On Thu, Apr 22, 2010 at 15:18, Dave Angel wrote: > The same difference as between handing the paper boy three bucks, versus > flying to London to open an account, making a deposit, going to a branch in > Sydney and asking for a bank check, then flying back home and taking the > paper boy with you

Is there a better way to set a system clock in Python (on a Linux system)

2010-05-05 Thread J
Is there a better way to do this? def SkewTime(): ''' Optional function. We can skew time by 1 hour if we'd like to see real sync changes being enforced ''' TIME_SKEW=1 logging.info('Time Skewing has been selected. Setting clock ahead 1 hour') # Let's get our current ti

Re: write a 20GB file

2010-05-14 Thread J
On Fri, May 14, 2010 at 07:32, Jackie Lee wrote: > Thx, Dave, > > The code works fine. I just don't know how f.write works. It says that > file.write won't write the file until file.close or file.flush. So I > don't know if the following one is more efficient (sorry I forget to > add condition to

  1   2   3   4   5   6   7   8   9   10   >