Hello,
I have several CGI scripts that I would like coordinate via a "First In / First
Out" style buffer.That is, some processes are adding work units, and some
take the oldest and start work on them.
What is the right way to do this?I suppose I could use an SQL server or
SQlite , but
> "Allen Fowler" wrote
> > I have several CGI scripts that I would like coordinate via a "First In /
> First Out" style buffer.That is, some processes are adding work units,
> and
> some take the oldest and start work on them.
> >
> >
Hello,
Imagine the relationship between an Ice Cream retail store and the several
manufactures that supply it's flavors.
The retail store has a single list of flavors and any given flavor can be made
by one or more manufactures. (Most are made by several.)
The store's stock monitoring system
> The difference between objects is measeured by their interfaces not their
> data
> so provided the supplier objects all use the same operations of a Flavor then
> its not too bad. You can either create subclasses of Flavor for each
> manufacturer that retuirns the requisite list of attrib
Hello,
In terms of in-code documentation of function / section headers, change logs,
etc. Are there well-done sample files I can use as inspiration?
Thank you,
:)
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listi
Hello,
Are there any utilities to help "spell check" source code? (Docstrings, etc)
Thank you,
:)
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hello,
I'm looking for some suggestions as to the filesystem source code layout for a
new project.
Here is what I am thinking so far:
root_folder/
- app/ -- Code for our pylons/django/TG/etc web app
- web/ -- Public static web files (and wsgi / fastCGI connector files)
- db/ -- SQlite DB
- scr
>
> My 2 cents...
>
> 1) Since you are describing your source code layout, any virtual
> environment should be outside. A virtual environment (virtualenv) is
> part of deployment and not part of source. If you need to make a
> reproducible deployment environment, then you need a deployment syst
Hello,
What is the recommended way to configure my application find the various
database and/or configuration files it needs?
For instance my folder layout:
/path_to_app/app.py
/path_to_app/lib/
/path_to_app/database/
/path_to_app/config/
/path_to_app/photos
and so on. (app.py being th
> > What is the recommended way to configure my application find the various
> database and/or configuration files it needs?
>
> Recommemded by whom? A lot depends on the OS. Apple for example have one set
> of
> recommendations for MacOS, Windows has another and Linux has several to
> cho
> > Assuming the application could be invoked in odd ways that may alter the
> notion of the current working directory, how do I unambiguously find the
> absolute path to the current python source file? (So I can load the nearby
> .ini)
>
> I use a helper function that calculates the absol
> Martin Walsh
>
> Allen Fowler wrote:
> >
>
> >
> > As a follow-up question, how do give my modules stored under ./lib access
> > to
> the data in my ConfigParser object? (For instance, database connection
> string,
> storage path, etc.)
>
> Something like this ...
>
> # lib/mypaths.py
> # --
>
> import os
>
> def script_path(base):
> return os.path.realpath(os.path.abspath(base))
>
> def script_dir(base):
> return os.path.dirname(script_path(base))
>
> def join_relative(base, path):
> return os.pa
> >
> > FWIW:
> >
> > When using relative paths I got extra ../../ terms, so I changed
> join_relative() to:
> >
> > def join_relative(base, path):
> > return os.path.normpath(os.path.join(script_dir(base), path))
> >
> >
> > Seems to work...
>
>
> Yeah, good catch ... looks great,
Hello,
I have some CSV data from Office / OpenOffice in "nearly ASCII" format. This
is just basic text but it it stored as UTF-8, and has curly quotes, etc.
Is there a way to easily read the file as ASCII by forcing these to the
standard ASCII equivalents?
Thank you
___
Hello,
"He's a great guy".title()
Gives me:
"He'S A Great Guy"
I expected:
"He's A Great Guy"
Did i miss something here?
Thank you,
:)
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hello,
I have a list of tasks/items that I want handed off to threads/processes to
complete. (I would like to stick with process if I could, since there is some
CPU work here. )
Each task involves some calculations and a call to a remote server over
urllib2/HTTP.
The time to complete each
Hi,
My code looks like this:
for item in bigset:
self.__sub1(item)
self.__sub2(item)
self.__sub3(item)
# the subX functions, in turn, use various 3rd party modules.
Now, I would like to do this:
for item in bigset:
try:
self.__sub1(item)
self.__sub2(item)
I seem to be having an issue with __getattr__() being called even if the
proporite already exists... I thought that this was not supposed to happen.
Is there a typo somewhere, or I do i misunderstand things?
class someclass(object):
def __init__(self, **kargs):
self.val
Eric Brunson <[EMAIL PROTECTED]> wrote: Allen Fowler wrote:
> I seem to be having an issue with __getattr__() being called even if
> the proporite already exists... I thought that this was not supposed
> to happen.
I think you've misunderstood. __getattr__() should
What did you try? What happened? What did you expect?
Kent
Narrowed things down a bit.
Given this class:
---
class sc(object):
def __init__(self, **kargs):
self.valid_props = [ 'foo', 'bar', 'baz' ]
for prop in self.valid_props:
> "Note that if the attribute is found through the normal mechanism,
> __getattr__() is not called. (This is an intentional asymmetry between
> __getattr__() and __setattr__().) This is done both for efficiency
> reasons and because otherwise __setattr__() would have no way to
> access other
Umm... well. obviously I left out an __setattr__() call..
sigh.
thanks anyway...
Allen Fowler <[EMAIL PROTECTED]> wrote:
What did you try? What happened? What did you expect?
Kent
Narrowed things down a bit.
Given this class:
---
class sc(
Hello,
I have a block of code buried deep in a module that I expect to fail
periodically. (Calls to other machines over slow network, and such.)
Generally, though, trying it a second / third will work.
Is there clean way to write this on Python?
Thanks
_
Hello,
How can a make a python script run in "deamon mode"? (on a linux box)
That is, I want to run the program via "python myfile.py" and have it drop me
back to the command line. The program should continue running until I kill it
via it's PID, the machine shuts down, or the program itself d
Thank you for all the great tips... I'll try a few and see what works.
I must say that I'm a bit surprised that the Python Std library does not have a
module for this. Are all python scripts expected to be small user-mode
utilities?
_
Hello,
I have several hundred WMV video files with bad embedded author/title/date
information.
However, the correct information is correctly encoded in the file name.. i.e.
"title-author-date.wmv"
Seems like the a great job for Python. :)
Also, I am about to convert these fiiles to MP4 f
nt: Tuesday, March 4, 2008 7:32:01 PM
> Subject: Re: [Tutor] Video file metadata? (MP4/WMV)
>
>
> "Allen Fowler" wrote in
>
> > 1) Does these exist a python module I can use to
> > programatically edit the metadata in MP4
> > files?
>
> I don;
Hello,
I have code that looks something like:
self.aString = "abc123xyz"
self.theNumber = int(re.search('(\d+)',self.aString).group())
Is there a more Pythonic way of doing this? (Both the reg-ex and the Int
coercion.) How about when I will need to extract more than one substring?
Thank you,
Hello,
I need to call an external command line .exe utility from my Python script.
What is the best way to capture the output (if any) and (optionally) direct it
to my normal standard output?
There seem to be many options...
Thank you,
:)
_
Thank you for the help. :)
- Original Message
simplest way to run external commands !
import os
cmd="/usr/bin/ssh 10.0.0.20 uptime"
os.popen(cmd)
my cmd is just an example, use any cmd you want & its output will be displayed
to you.
hope this helps
[SNIP]
subprocess.Popen().com
s.
>
> To convert, use a list comprehension:
> self.allNumbers = [int(i) for i in self.digit_extractor.findall(self.aString)]
>
> Cheers
>
> On Wednesday 12 March 2008 21:59, Allen Fowler wrote:
> > Hello,
> >
> > I have code that looks something like:
> >
Hello,
Now, perhaps this not the best way write code, but I have a few questions
regrading calling the super classes constructor:
I have a super class that accepts many arguments to it's constructor, and a
subclass that should define one additional argument.
What's the most "pythonic" way to m
Hello,
What's the best way convert keyword arguments to object properties?
Basically, I have a defined list of valid object properties that I'd like to
optionally specify in the call to the constructor.
I've got ideas about using __getattr__ but I'm not sure if that's the right
way. Plus, tha
> > class MySubClass(MySuperClass):
> >
> > def __init__(self, just_a_sub_option): # what about other args? **args?
>
> I think I would go ahead and list the superclass parameters and put the
> new one at the end:
> def __init__(self, opt_1, opt_2, opt_3, opt_n, just_a_sub_option):
>
> > What's the most "pythonic" way to make this work?
>
> class BaseClass(object):
> def __init__(self, x, y, z, foo='foo'): # whatever
> # etc
>
> class SubClass(BaseClass):
> def __init__(self, t, *args, **kw):
> BaseClass.__init__(self, *args, **kw)
> # do something with t
>
> Nowadays the best practice for invoking a method from all superclasses
> (yes, multiple inheritance) is this:
>
> class SubClass(BaseClass):
> def __init__(self, t, *args, **kw):
> super(SubClass, self).__init__(*args, **kw)
> # do something with t
>
> That way you let Pyth
37 matches
Mail list logo