On Friday, September 9, 2016 at 11:31:13 AM UTC-7, Peter Otten wrote:
> Josh English wrote:
>
> >
> > LOG = logging.getLogger('SHIPPING')
> > FORMAT = '%(asctime)-15s %(name)s %(level)-8s %(message)s'
>
> That should be either levelname or
On Friday, September 9, 2016 at 11:29:32 AM UTC-7, John Gordon wrote:
> In <247db0ab-efe7-484b-a418-dd219f68a...@googlegroups.com> Josh English
> writes:
>
> > When I run the scriptI get logging information from only xlreader, not
> > from the main script:
>
>
I have a Python script that imports a utility script. Both scripts use logging,
but the logs don't work as advertised. I'm getting logging output from the
utility script but none from the main file. Worse, the format of the utility
script's logs don't match anything I define.
The utility script
On Saturday, August 1, 2015 at 3:52:25 PM UTC-7, Lukas Barth wrote:
> On Saturday, August 1, 2015 at 11:37:48 PM UTC+2, Emile van Sebille wrote:
> > Well, it looks to me that I don't know what a 'canonical rotation' is --
>
> That's because it is not defined. ;)
>
> I need a way to rotate one of
Thanks for the discussion. I found my original concern was supposedly about
sourceforge. PyPi, according to a post over on pypubsub-dev that pip installs
had anecdotal problems with sourcforge-hosted projects.
I guess I wanted some more anecdotes and opinions before I tried moving
anything.
I
I've been hosting Python projects on Google Code, and they're shutting down.
Damn.
What is the recommended replacement for Code Hosting that works reliably with
PyPi and pip?
--
https://mail.python.org/mailman/listinfo/python-list
On Wednesday, December 17, 2014 11:11:11 AM UTC-8, Juan Christian wrote:
> I know about the schedule modules and such but they work in situations like
> 'run this in a X hours/minutes/seconds interval', I already have my code in a
> while loop with sleep (it's a bit ugly, I'l change to a schedule
On Sunday, September 14, 2014 10:59:07 AM UTC-7, Terry Reedy wrote:
> On 9/14/2014 2:44 AM, Josh English wrote:
>
>
> To the best of my knowledge, protocol.py, brine.py, compat.py, are not
> part of the stdlib. What have you installed other than Python? What
> editor/IDE are
On Monday, September 15, 2014 12:12:50 PM UTC-7, Emile van Sebille wrote:
>
> That's your clue -- I'd take a close look at the last changes you made a
> result of which caused this failure and apparent looping.
> It's easy to lay blame on the (whatever) library and look for a root
> cause there
On Wednesday, September 3, 2014 7:19:07 PM UTC-7, Ned Batchelder wrote:
> Typically, you need to decide explicitly on a serialized representation
> for your data. Even if it's JSON, you need to decide what that JSON
> looks like. Then you need to write code that converts the JSON-able
> data
I do not know what these three filesare doing, but suddenly they have caught in
a loop every time I try to run some code.
I grabbed the trace decorator from the python library and this is the last bit
of the output:
trollvictims.py(129): if self.current_attack:
trollvictims.py(130):
On Wednesday, September 3, 2014 1:53:23 PM UTC-7, Ned Batchelder wrote:
> Pickle (and it looks like jsonpickle) does not invoke the class'
> __init__ method when it reconstitutes objects. Your new __init__ is not
> being run, so new attributes it defines are not being created.
>
> This is one o
I am using jsonpickle to store instances of an object into separate data files.
If I make any changes to the original class definition of the object, when I
recreate my stored instances, they are recreated using the original class
definition, so any new attributes, methods, or properties, are lo
On Saturday, June 7, 2014 1:24:43 PM UTC-7, Tim Golden wrote:
>
> I'm not 100% sure what your scenario is, but you can certainly help
> yourself and us by running the same test on the raw interpreter and then
> under PyScripter to determine if the behaviour is to do with IDLE or
> with Python it
I have been using os.startfile(filepath) to launch files I've created in
Python, mostly Excel spreadsheets, text files, or PDFs.
When I run my script from my IDE, the file opens as I expect. But if I go back
to my script and re-run it, the external program (either Excel, Notepad, or
Acrobat Re
Mea culpa, gang.
I found it.
It had absolutely nothing to do with the multiplication.
It was in zero_matrix.
I feel like a fool.
Josh
--
https://mail.python.org/mailman/listinfo/python-list
I am trying to whip up a quick matrix class that can handle multiplication.
Should be no problem, except when it fails.
--- Begin
#!/usr/bin/env python
# _*_ coding: utf-8
from operator import mul
class Matrix(object):
"""Matrix([data])
Data should be a list of equal sized lists.
De
I loved RoboWar on my Mac, many ages ago.
I wrote a Stack based language very similar to the one RoboWar used. If you're
interested, let me know.
Josh English
On Saturday, May 3, 2014 3:28:34 PM UTC-7, Lee Harr wrote:
> pybotwar is a fun and educational game where players
> wri
On Monday, April 7, 2014 9:08:23 PM UTC-7, Chris Angelico wrote:
> That depends on whether calling Brand() unnecessarily is a problem.
> Using setdefault() is handy when you're working with a simple list or
> something, but if calling Brand() is costly, or (worse) if it has side
> effects that you
On Sunday, April 6, 2014 12:44:13 AM UTC-7, Giuliano Bertoletti wrote:
> obj = brands_seen.get(brandname)
>
> if obj is None:
> obj = Brand()
> brands_seen[brandname] = obj
>
>
Would dict.setdefault() solve this problem? Is there any advantage to
defaultdict over setdefault()
Josh
On Wednesday, April 2, 2014 4:33:07 PM UTC-7, Jason Swails wrote:
> From there, you can implement a method interface in which the child Cmd
> subclasses can call to indicate to BossCmd that do_exit has been called and
> it should quit after the child's cmdloop returns. So something like this:
>
I have a program with several cmd.Cmd instances. I am trying to figure out what
the best way to organize them should be.
I've got my BossCmd, SubmissionCmd, and StoryCmd objects.
The BossCmd object can start either of the other two, and this module allows
the user switch back and forth between
On Tuesday, March 11, 2014 9:25:29 AM UTC-7, John Gordon wrote:
>
>
>
>
> Why do you say that 'key=lambda x: x.name.lower' is the correct form? That
>
> returns the str.lower() function object, which is a silly thing to sort
>
> on. Surely you want to sort on the *result* of that function, w
A comprehensive and educational answer, Peter. Thank you.
Josh
--
https://mail.python.org/mailman/listinfo/python-list
sort
properly.
Any ideas why I'm seeing two different results? Especially as the correct form
is giving me the wrong results?
Josh English
--
https://mail.python.org/mailman/listinfo/python-list
On Wednesday, September 25, 2013 4:24:22 PM UTC-7, Arturo B wrote:
> Hi, I'm doing Python exercises and I need to write a function to flat nested
> lists
> So I know what recursion is, but I don't know how is
>
>flatten(i)
>
> evaluated, what value does it returns?
>
Reduce tricks are nice, but I prefer clarity sometimes:
def double(x):
return x*2
def add3(x):
return x+3
def compose(*funcs):
for func in funcs:
if not callable(func):
raise ValueError('Must pass callable functions')
def inner(value):
for func in fu
On Saturday, August 10, 2013 4:21:35 PM UTC-7, Chris Angelico wrote:
> On Sun, Aug 11, 2013 at 12:14 AM, Roy Smith <> wrote:
>
> > Maybe you've got two different handlers which are both getting the same
> > loggingvents and somehow they both end up in your stderr stream.
> > Likely? Maybe not, bu
On Saturday, August 10, 2013 4:14:09 PM UTC-7, Roy Smith wrote:
>
>
> I don't understand the whole SimpleChecker class. You've created a
> class, and defined your own __call__(), just so you can check if a
> string is in a list? Couldn't this be done much simpler with a plain
> old function
:40 PM, Roy Smith wrote:
>>
>> In article ,
>> Josh English wrote:
>>
>>> I am working on a library, and adding one feature broke a seemingly
>>> unrelated
>>> feature. As I already had Test Cases written, I decided to try to
>>>
On Saturday, August 10, 2013 1:40:43 PM UTC-7, Roy Smith wrote:
> In article ,
>
> Josh English wrote:
> The first thing to do is get this down to some minimal amount of code
> that demonstrates the problem.
>
>
>
> For example, you drag in the logging modul
f
SimpleChecker - DEBUG - calling f
--
Ran 2 tests in 0.013s
OK
Exit code: False
Why am I seeing those extra debugging lines? In the script I'm really trying to
debug, I see 12-13 debug messages repeated, making actual debugging difficult.
Josh English
--
http://mail.python.org/mailman/listinfo/python-list
On Saturday, December 8, 2012 9:40:07 AM UTC-8, Peter Otten wrote:
>
>
>
> Two underscores trigger name mangling only in a class, not in a module.
>
> Don't try to hide the Options instance:
>
>
>
> # module config.py
>
> import ConfigParser
>
>
>
> class Options(ConfigParser.SafeConfig
I am trying to create a Singleton SafeConfigParser object to use across all the
various scripts in this application.
I tried a Singleton pattern found on the web:
class Singleton(object):
def __new__(cls):
if not hasattr(cls, '_inst'):
print "Creating Singleton Object"
On Friday, June 29, 2012 10:08:20 AM UTC-7, Steven D'Aprano wrote:
> c = (1,3)
> s = "{0[0]}"
> print s.format(c)
> > '1'
>
> That's not actually the output copied and pasted. You have quotes around
> the string, which you don't get if you pass it to the print command.
>
Mea culp
On Friday, June 29, 2012 10:02:45 AM UTC-7, MRAB wrote:
>
> The ".format" method accepts multiple arguments, so the placeholders in
> the format string need to specify which argument to format as well as
> how to format it (the format specification after the ":").
>
> The "format" function, on th
I have a list of tuples, and usually print them using:
print c, " ".join(map(str, list_of_tuples))
This is beginning to feel clunky (but gives me essentially what I want), and I
thought there was a better, more concise, way to achieve this, so I explored
the new string format and format() funct
On Monday, June 25, 2012 11:57:39 PM UTC-7, Peter Otten wrote:
> >
> > There is nothing in the documentation (that I have found) that points to
> > this solution.
>
> That's because I "invented" it.
>
Oh bother. The lines I completely overlooked were in your __getattr__ override.
Boy is my fa
On Sunday, June 24, 2012 1:07:45 AM UTC-7, Peter Otten wrote:
>
> You cannot access a class instance because even the class itself doesn't
> exist yet. You could get hold of the class namespace with sys._getframe(),
>
> def add_help(f):
> exec """\
> def help_%s(self):
> f = getattr(self
I'm creating a cmd.Cmd class, and I have developed a helper method to easily
handle help_xxx methods.
I'm trying to figure out if there is an even lazier way I could do this with
decorators.
Here is the code:
*
import cmd
def add_help(func):
if not hasattr(func, 'im_cl
On Monday, May 7, 2012 6:13:28 AM UTC-7, dinkyp...@gmail.com wrote:
>
> Below is a test script that shows one way I've dealt with this issue in the
> past by reformatting paragraphs to remove embedded line breaks. YMMV.
>
> import re, textile
> ...
Wow. Thank you. This works. I'm trying to fig
I am working with an XML database and have large chunks of text in certain
child and grandchildren nodes.
Because I consider well-formed XML to wrap at 70 characters and indent
children, I end up with a lot of extra white space in the node.text string. (I
parse with ElementTree.)
I thought abo
Site Packages folder, I
have xlrd-0.7.1-py2.7-win32.egg as an egg file, but xlrd-0.7.5-py2.7.egg as
a folder.
This in on a Windows 7 machine.
I didn't think EGG files could be folders. Is there a change in the way the
EGG file was meant to be distributed?
Josh English
Confused Data G
On Monday, February 27, 2012 6:37:25 PM UTC-8, Ray Clark wrote:
>
> You have to remember that this course assumes no prior computer
> programming knowledge.
>
> I agree, it is starting out very basic. Give it some more time.
> These guys have PhDs from MIT and/or have taught at Stanford. They
>
Has anyone here looked at Udacity's open CS101 course
(http://www.udacity.com/overview/Course/cs101) that started this week? The goal
of the seven week course is to build a web crawler.
So far, I'm not impressed with the speed or content of the course. I was
wondering what anyone here may think
The problem shows up when the application starts. It tries to read the file but
the lock mechanism times out because the file is still around after the last
time the application ran.
It's a wxPython program. The code to unlink the .lock files is run in the
wxApp.OnInit method (before any code t
This is a follow-up to some questions I posted a month or two ago. I have two
programs running on various Windows XP boxes, sharing several resource files on
a Windows 2003 server. It's a mapped drive on the workstations to a shared
folder.
I am using a locking utility that works by creating ".
OKB,
The setup.py script created the egg, but not the .pth file. I created that
myself.
Thank you for clarifying about how .pth works. I know "redirect imports" was
the wrong phrase, but it worked in my head at the time. It appears, at least on
my system, that Python will find site-packages/fo
When I run: os.listdir('c:\Python27\lib\site-packages') I get the contents in
order, so the folders come before .pth files (as nothing comes before
something.) I would guess Python is using os.listdir. Why wouldn't it?
--
http://mail.python.org/mailman/listinfo/python-list
I have .egg files in my system path. The Egg file created by my setup script
doesn't include anything but the introductory text. If I open other eggs I see
the zipped data, but not for my own files.
Is having a zipped egg file any faster than a regular package? or does it just
prevent people fr
Philip,
Yes, the proper path should be c:\dev\XmlDB, which has the setup.py, xmldb
subfolder, the docs subfolder, and example subfolder, and the other text files
proscribed by the package development folder.
I could only get it to work, though, by renaming the xmldb folder in the
site-packages
(This may be a shortened double post)
I have a development version of a library in c:\dev\XmlDB\xmldb
After testing the setup script I also have c:\python27\lib\site-packages\xmldb
Now I'm continuing to develop it and simultaneously building an application
with it.
I thought I could plug into
I am developing a library for Python 2.7. I'm on Windows XP. I am also learning
the "proper" way to do this (per PyPi) but not in a linear fashion: I've built
a prototype for the library, created my setup script, and run the install to
make sure I had that bit working properly.
Now I'm continu
That would be one of mine, probably.
http://code.google.com/p/pyxmlcheck/
It's an old version. I haven't updated it in a while.
And while my program worked fine at home, my test environment gave me some
grief. Apparently the lock files are being deleted properly. I have a few ideas
about that,
Chris,
I got my solution working, at least on my local machine. I'm trying to bundle
it for testing on location.
I've thought about the server-client model and one day I may have the guts to
tackle that, but I don't think it's this project.
Sadly, I'm the type of guy who almost has to re-inve
Chris,
Thank you for spelling this out. I thought about this as a solution but I don't
have the skills to create this server application, and I don't know if the
target network can handle this request. They can see files on a shared drive.
They can't see each other's computers on the network, a
I found a FileLock (lost the link and it's not in the code) that uses context
managers to create a ".lock" file in the same directory of the file. It uses
os.unlink to delete the .lock file but I don't know if this deletes the file or
just removes it from the directory and leaves the memory fill
Cameron,
You use a directory as lock mechanism. I think I get how that works.
When you're done manipulating the file, do you just remove the director?
Josh
--
http://mail.python.org/mailman/listinfo/python-list
Maybe not to the gurus here, but for me, this is a complex problem and I want
to make sure I understand the real problem.
All of this is in Python 2.7 and wxPython
I have several XML files on a shared drive.
I have applications on other machines that need to access this XML file.
These applicati
On Wednesday, February 9, 2011 10:34:12 AM UTC-8, noydb wrote:
>
> How do you add all the records in the particular field of interest
> into long_list?
Sorry to be unclear. In both cases I was tossing out pseudo-code, as I am not
familiar with the arggisscripting module. long_list is a list wit
On Wednesday, February 9, 2011 9:52:27 AM UTC-8, noydb wrote:
>
> So it seems the idea is to add all the records in the particular field
> of interest into a list (record). How does one do this in pure
> Python?
> Normally in my work with gis/arcgis sw, I would do a search cursor on
> the DBF fi
You could try a collections.defaultdict object with an integer as the startup
value:
counts = collections.defaultdict(int)
for thing in long_list:
counts[get_last_two_digits(thing)] += 1
This assumes get_last_two_digits is the function that provides the key you want
to count by. I'm not sure
I found the code posted at
http://infix.se/2007/02/06/gentlemen-indent-your-xml
quite helpful in turning my xml into human-readable structures. It works
best for XML-Data.
Josh
--
http://mail.python.org/mailman/listinfo/python-list
Oh, and I usually use a separate function to indent my xml for readability when
I need to actually look at the xml. It's easier than trying to change the
element in situ and make it look nice.
Josh
--
http://mail.python.org/mailman/listinfo/python-list
Here's a trimmed down version of how I did this (using ElementTree standalone,
but the API should be the same)
This is from a class definition and the _elem attribute is a link to an
ElementTree.Element object.
...
def _add_elem(self, tagName, text, attrib ={}):
"""_add_elem(tagName,
I think it depends on where you're willing to deal with changes. As it stands,
if you make changes to get_all that will effect the way get_even works. If
there's a logical chain that your code needs to follow and such changes would
be acceptable, use them, because it's easier to change one thing
Steven,
This was simplified. The complete story is, well, tedious:
I have created a set of XML Validation and Normalization classes. With them I
can define my data structures and make sure my data is good. These
complications have come in wanting to take this tool and create a GUI (in
wxPytho
Chas,
Thanks. The "self" in the setattr statement works sometimes, but what I'm
adding most of the time is a property, and if I don't use the class when
setting a property, nothing works. The property is returned instead of the
value of the function the property returns. (yeah, it's complicated
I have hit yet another wall. I am dynamically creating a class and then
creating instances of that class. The class relies on a second class to store a
list of objects. (This is simplified from the the original by a factor of about
20. The real program is trying to create a Python object around
I have no idea. That's a lower level of programming than I'm used to
dealing with.
Josh
(I also only tried the one value. Had I tried with other strings that
would fail the test, some
functions may have performed better.)
On Aug 29, 2:19 am, Matteo Landi wrote:
> Well, I tried the also the solu
This whole conversation got interesting, so I thought I'd run some
speed tests:
The code:
from timeit import Timer
def is_palindrome_recursive(s):
if len(s) <= 1:
return True
if s[0] != s[-1]:
return False
else:
return is_palindrome(s[1:-1])
def is_palindrome_
On Aug 28, 9:14 am, agnibhu wrote:
> Hi all,
>
> I'm a newbie in python. I'm trying to create a library for parsing
> certain keywords.
> For example say I've key words like abc: bcd: cde: like that... So the
> user may use like
> abc: How are you bcd: I'm fine cde: ok
>
> So I've to extract the "
On Aug 26, 10:02 pm, Stefan Behnel wrote:
> Josh English, 27.08.2010 01:30:
>
> > solve a lot of the problems I'm running into in my own attempt to
> > build a python Class implementation of an XML Validation object.
>
> How would object serialisation help here?
&
It looks nice, but it's a shame it doesn't work on Windows. This
could
solve a lot of the problems I'm running into in my own attempt to
build a python Class implementation of an XML Validation object.
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 1, 3:30 pm, "Rhodri James" wrote:
>
> If this is a version of your code that actually fails when you run it
> (rather than being another artistic interpretation of a photograph of your
> code :-), then I'd go with Matt's analysis. This will give you a
> NameError for fws_last_col if
On Jul 1, 2:50 pm, Matt McCredie wrote:
>
> That doesn't give me enough information to help you with the issue. In general
> you need to provide enough code to reproduce the failure, not some modified
> version that doesn't fail. My guess is that the "if True" is actually
> something
> else, and
I have a script that generates a report from a bunch of data I've been
collecting for the past year. I ran the script, successfully, for
several weeks on test runs and creating more detailed reports.
Today (back from vacation) and the script doesn't work. It's giving me
a name error.
I'm running
On Apr 9, 8:36 am, Emile van Sebille wrote:
> On 4/9/2010 8:04 AM Peyman Askari said...
>
> > Hello
>
> > This is partly Python related, although it might end up being more math
> > related.
>
> > I am using PyGTK (GUI builder for Python) and I need to find the
> > intersection point for two lin
Chris,
Thanks. This worked for the attributes, but I think the tactic is
still misleading. There are child elements I can't quite determine how
to deal with:
Analog Science Fiction and Fact
Analog
Science Fiction
First Contact
Hard Science Fiction
Stanley Schmidt
teError: 'module' object has no attribute 'day_abbr'
err... what? Is this an old weirdness I don't remember from the 2.5
series?
I can select dates in the calendar, but nothing dismisses it but the
close box.
Josh English
Incredibly Confused
--
http://mail.python.org/mailman/listinfo/python-list
s and have it run?
I have had a few solutions work where I had a class with three methods
(get_code, get_tier, get_mail) but they all return the same value, not
the individual values.
Josh English
--
http://mail.python.org/mailman/listinfo/python-list
I have several pages exported from a private MediaWiki that I need to
convert to a PDF document, or an RTF document, or even a Word
document.
So far, the only Python module I have found that parses MediaWiki
files is mwlib, which only runs on Unix, as far as I can tell. I'm
working on Windows here
Sorry, I was referring to the abstract base classes defined there...
mea culpa. I didn't get out of my head while posting.
Josh
On Apr 24, 4:15 pm, Jerry Hill wrote:
> On Fri, Apr 24, 2009 at 6:56 PM, Josh English
>
>
> Doug Hellmann wrote an article on the collections module
In my quest to learn more, I've been trying to get the collections.py
module to do anything but look cool. So far, it's only a cool idea.
How do they work? I can't find a tutorial on the web anywhere
explaining how I would use them in my code.
Any clues?
Josh
--
http://mail.python.org/mailman/lis
On Aug 14, 1:18 pm, ariel ledesma <[EMAIL PROTECTED]> wrote:
> hello guys
>
> i just ran into this when comparing negative numbers, they start
> returning False from -6 down, but only when comparing with 'is'
>
> >>> m = -5
> >>> a = -5
> >>> m is a
> True
> >>> m = -6
> >>> a = -6
> >>> m is
A good starting point is Mark Pilgrim's Dive Into Python.
http://www.diveintopython.org/unit_testing/index.html
Josh
On Jun 23, 7:55 am, Alex <[EMAIL PROTECTED]> wrote:
> Hi all.
>
> I'd like learn some basic unit testing with python.
> I red some articles about different testing framework like u
When testing the package in idle, this results in
C:\Python25\Lib\idlelib
instead of the file.
The Data folder is created in this folder now.
On 2/18/08, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
> En Sun, 17 Feb 2008 22:34:27 -0200, Josh English
> <[EMAIL PROTECTED]> escr
__init__.py module to use relative
paths to its own module, and not the current working directory the os
module provides?
This could also solve the problem with Config.py, I think.
Thanks
Josh English
http://joshenglish.livejournal.com
--
http://mail.python.org/mailman/listinfo/python-list
88 matches
Mail list logo