Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #41576

Re: Best way to find starting directory

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <davea@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'remind': 0.05; 'schema': 0.05; 'xml,': 0.05; 'parameter': 0.07; 'type,': 0.07; 'users,': 0.07; 'definition,': 0.09; 'enormous': 0.09; 'separately': 0.09; 'stored': 0.10; 'server,': 0.15; 'clear.': 0.16; 'in-memory': 0.16; 'objects?': 0.16; 'parser.': 0.16; 'threads': 0.16; 'wrote:': 0.17; 'variables': 0.17; '>>>': 0.18; 'code,': 0.18; 'versions': 0.20; 'putting': 0.20; 'file.': 0.20; 'parse': 0.22; 'sets': 0.23; 'script': 0.24; 'pass': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'creating': 0.26; 'am,': 0.27; 'separate': 0.27; 'decide': 0.28; 'fine': 0.28; 'run': 0.28; 'subsequently': 0.29; 'them?': 0.29; 'starts': 0.29; 'maybe': 0.29; 'expect': 0.31; 'code': 0.31; 'file': 0.32; 'not.': 0.32; 'running': 0.32; 'to:addr:python-list': 0.33; 'another': 0.33; 'version': 0.34; "can't": 0.34; 'updated': 0.34; 'wrong': 0.34; 'path': 0.35; 'something': 0.35; 'there': 0.35; 'explain': 0.36; 'but': 0.36; 'enough': 0.36; 'xml': 0.37; 'does': 0.37; 'two': 0.37; 'why': 0.37; 'well.': 0.37; 'subject:: ': 0.38; 'fact': 0.38; 'things': 0.38; 'there,': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'easily': 0.39; 'called': 0.39; 'where': 0.40; 'received:192.168': 0.40; 'your': 0.60; "you've": 0.61; 'tracking': 0.61; 'different': 0.63; 'ever': 0.63; 'more': 0.63; 'other.': 0.64; 'making': 0.64; 'soon': 0.70; 'received:74.208': 0.71; 'frank': 0.75; 'companies,': 0.78; 'etc),': 0.84; 'presumably': 0.84; 'subject:find': 0.84; 'subject:Best': 0.91; 'angel': 0.93
Date Wed, 20 Mar 2013 04:56:16 -0400
From Dave Angel <davea@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130221 Thunderbird/17.0.3
MIME-Version 1.0
To python-list@python.org
Subject Re: Best way to find starting directory
References <ki93v1$s7f$1@ger.gmane.org> <ki95lp$bel$1@ger.gmane.org> <ki975r$odu$1@ger.gmane.org> <51485E35.7090501@davea.name> <ki9snt$hrk$1@ger.gmane.org> <51487E55.6040704@davea.name> <kibj5h$nks$1@ger.gmane.org>
In-Reply-To <kibj5h$nks$1@ger.gmane.org>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:F2nwhmOWUdHXn1lSCollJDWhhHhWdjyThW+BErWf0+8 ffB99JPcyRoaaXSErkMhn7FPhIIe8e+uW/EZckcYfqEeFV9UdI SQLX/ujPvVntEcMQamdoS06DRwgFhwHBm0NoUf2IiZiOYfR3/e E2oj1+qvm4iCRM1IP3dPRtem8OBlyN16fn1PJxr5ASGlyZiyKn NrWjd4qjthWZX4hCNtjZNGJydcTEiydtwb7oV/gc4wWpZuugIC g8zjejdCO9RuW/8oZEgzzVTH+eXK1jETPhzwaG/ObwMPVrqdKV cmpyq4yiuL7o6qZmpi7HLri4hd73en8xrfPScIft4JGMDnLwg= =
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3552.1363769790.2939.python-list@python.org> (permalink)
Lines 59
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1363769790 news.xs4all.nl 6843 [2001:888:2000:d::a6]:35257
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:41576

Show key headers only | View raw


On 03/20/2013 01:58 AM, Frank Millman wrote:
> On 19/03/2013 17:03, Dave Angel wrote:
>> On 03/19/2013 10:29 AM, Frank Millman wrote:
>>> On 19/03/2013 14:46, Dave Angel wrote:
>>>   <SNIP>
>> In putting them there, you are making two assumptions.  One is that only
>> one user will ever run this, and two is that the user will not need two
>> sets of those 'schemas'.  If the user is tracking two different
>> companies, each with the same code, but different xml and different
>> database, this would be the wrong place to put it.  But it's up to you
>> to decide those assumptions, not I.
>>
>
> Maybe I did not explain very well. I fully expect a large number of
> users, tracking a large number of companies, to access the same schema
> file at the same time.

So the scheme does NOT describe an individual company, but something 
more general?  Presumably there's a separate database per company?  Why 
then is the schema separately stored in each database?

>
> In fact I use lxml to parse the xml once it has been read from the
> database and decompressed. There are a limited number of 'types' of xml
> file (form definition, service definition, report definition, etc), and
> each type has its own schema. lxml will use a validating schema if you
> pass the path to the xsd file as a parameter to the parser. I create
> separate parsers, one for each type, when the program starts. But I
> still need to tell it where to find the xsd file.
>
> They are stored in a sub-directory called 'schemas'.

Clearly I don't understand your model well enough to advise you one way 
or the other.  All I can do is ask questions whose answers might remind 
you of things you know but I do not.

This code is running on a server, with simultaneous users?  And all 
users who run it will be using identical xml, which will only be updated 
when a new version of the script is installed?  And each time a user 
starts the application, you read the xml from the database, write it to 
a sub-directory 'schemas'  and subsequently in the run you access it 
with lxml?  You've considered what happens when one user is creating the 
files, while another user is still accessing them?

Are these 'files' so enormous that you can't just use in-memory file 
objects?

The analogy to global variables must be clear.  They're fine if they're 
constant.  But as soon as you have multiple threads making new versions 
of them, everything can easily get out of whack.







-- 
DaveA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Best way to find starting directory Dave Angel <davea@davea.name> - 2013-03-20 04:56 -0400

csiph-web