Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:: [': 0.03; 'argument': 0.04; 'subject:Python': 0.05; 'method.': 0.05; 'socket': 0.05; 'arguments': 0.07; 'subject:help': 0.07; 'cmd': 0.09; 'filenames,': 0.09; 'imports': 0.09; 'skip:# 60': 0.09; 'sql,': 0.09; 'sqlite': 0.09; 'subject:2.7': 0.09; 'subject:Help': 0.10; 'def': 0.10; '........': 0.16; 'elsewhere.': 0.16; 'here..': 0.16; 'lowercase': 0.16; 'modules,': 0.16; 'parameters,': 0.16; 'sees': 0.16; 'socketserver': 0.16; 'subject:] [': 0.16; 'tcp': 0.16; 'threaded': 0.16; 'threading': 0.16; 'wrote:': 0.17; 'driver': 0.17; 'code,': 0.18; 'subject:] ': 0.19; 'load': 0.19; 'module': 0.19; 'skip:p 30': 0.20; 'parameters': 0.20; 'trying': 0.21; 'import': 0.21; 'names.': 0.22; 'help.': 0.22; 'device': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'question': 0.27; 'connects': 0.27; 'module.': 0.27; 'see,': 0.27; 'piece': 0.29; 'skip:( 50': 0.29; 'skip:q 20': 0.29; '"the': 0.29; 'class': 0.29; "we're": 0.30; 'attach': 0.30; 'bus': 0.30; 'function': 0.30; 'code': 0.31; 'file': 0.32; 'could': 0.32; 'getting': 0.33; 'builds': 0.33; 'skip:h 40': 0.33; 'handle': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; 'skip:d 20': 0.34; 'self': 0.34; 'done': 0.34; 'server': 0.35; 'whatever': 0.35; 'returning': 0.35; 'pm,': 0.35; 'something': 0.35; 'really': 0.36; 'but': 0.36; 'modules': 0.36; 'should': 0.36; 'thank': 0.36; 'execute': 0.37; 'two': 0.37; 'being': 0.37; 'data': 0.37; 'mean': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'where': 0.40; 'received:192.168': 0.40; 'your': 0.60; 'lower': 0.61; 'first': 0.61; 'different': 0.63; 'here': 0.65; 'stuck': 0.65; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'informations': 0.75; 'dali': 0.84; 'her,': 0.84; 'presumably': 0.84; 'received:74.208.4.194': 0.84; 'transmits': 0.84; 'understand,': 0.84; 'understood.': 0.84; 'habit': 0.91; 'anywhere,': 0.93; 'period.': 0.95 Date: Mon, 24 Dec 2012 00:19:18 -0500 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) References: <37264cd5-8acd-416b-a808-50216f9fbfa0@googlegroups.com> <3f14f739-e660-4883-a940-c77a6092cb79@googlegroups.com> In-Reply-To: <3f14f739-e660-4883-a940-c77a6092cb79@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:d9Fnh0OULFBDThCkE6ysiBMYfd4M5hwuP+CRx03fgtJ hzuSYiWlAdvSCszcJNn82s2wGuETUQlBTRrYt/zix2mmg0YMsq d/H5iQsfXlbDM2/KB5MPnkfQl8OYUvhYXBIIkR+mDOu3iUWOUB fC+erejPh8fl6b8iMIcfwh6U8etOFOPkUN8uPOrEDSTpke8rnI lmLVBr28o4NFwqyBE1op80MDjXg5iNzaliySvaYVWJSzEotPAL k7SbFKVMDsA6OCx7YYUP5KiN9ULneSZtOXQmT1sv66qV7bAtRB HV4ruSyQ4asFW+37YhmJMM5TBB7+xiS8mF8of7Cqd4A5Okt4AS M4W8M/Y92LnUDsFp54Yg= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: d@davea.name List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 84 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1356326385 news.xs4all.nl 6890 [2001:888:2000:d::a6]:54964 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:35441 On 12/23/2012 04:42 PM, prilisauer@googlemail.com wrote: > Okay, I try to publish this sample, and yes it's not a working piece of code, but I try to "draw" my problem that way. As you will see, I load modules, create cursor,... in the main.py. In the lower section you see, that the modules should execute sqls. In case It could occur that two queries occur at the same time. PS: IT IS NOT A QUESTION ABOUT SQL, etc. I do not understand, how I could handle the part which is marked with Problemsection1 and Problemsection2 You're miles from being ready to worry about "the same time." Don't start threading till you can get a simple multi-module program understood. > I hope really found the right "wording". thank to all your help. > > > main.py For some reason you capitalize all those filenames, so you're stuck with unpythonic module names. If you want your code readable, use lowercase for module name, and Capitalized for class name. > import HomeLog # LogHandler > import HomeSocketServer # Threaded TCP Socket Server > import HomeDatastore # SQLite DB > import HomeDaliServer # Connects to USB Device > import HomeScheduler # Advanced scheduler functions > > > # Attach Loghandler > Loghandler = HomeLog.Logging() > # Attach SocketServer > HomeSocketServer.HomeSocketServerStart() > > # Attach Scheduler > HomeSched = HomeScheduler.HomeScheduler() > HomeSched.SchedulerStart() > HomeSched.SchedulerJobs() > > # Attach Datastore > Datastore=HomeDatastore.HomeDBStore() > Datastore=Datastore.Startup() > > #Attach Dali Driver > Dali=HomeDaliServer.Startup() > # This is a "Sample" that builds 2byte Cmd and transmits it on bus > PowerOnLamp1=Dali.send(0,0,1,80) > > ############################################################### > HomeDaliServer.py import HomeDatastore > ........ > def send (self,DaliAdress,RequestType,Request,RequestValue): Nobody's going to be able to understand your code if you persist in using self in unpythonic ways. It's used as the first argument of a class method. Period. > # Problemsection1: > # Here it's getting Interesting > # We're at the HomeDaliServer, and now I want to use QuerySqlite() in the file HomeDatastore.py So call it: firstarg = whatever * RequestType secondarg = something different + RequestValue result = HomeDatastore.QuerySqlite(firstarg, secondarg) > ############################################################### > HomeScheduler.py Where are your import statements? No module automatically sees imports that were done elsewhere. Import what you need in a module. > # Problemsection2: > # If new workerthread is started, Informations must be queried using QuerySlite() and also update data I don't see any 'update data' function anywhere, but if you want to call QuerySqlite, you need to call it: thisresult = HomeDatastore.QuerySqlite(him, her, theother) > > ############################################################### > HomeDatastore.py > def QuerySqlite(): You presumably mean def QuerySqlite(firstparam, secondparam): since a function with no arguments is going to be stuck trying to use globals, and that's not a good habit to get into. > #doing something here.. #doing something with those parameters, and only those parameters > # returning Data > > ############################################################### > -- DaveA