473,327 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

loading modules, metaclasses, chicken & eggs

Hi,

I had two packages working fine toghether: debug and sqlkit. Debug
provides a metaclass just for debuggging purposes to sqlkit (to log
methods following a recipe on ASPN. It worked very well, just logging
depending on the value of a module variable in debug module. That
means module debug and it's variable where to be loaded before sqlkit.

Now I merged the two repos/packages (as I have publicly released them
and I thought it was easied to handle), but so doing:

from sqlkit import debug

already implies loading the class I want to log. In fact this class
Is loaded in

sqlkit/__init__.py

as it's the main one of the packages
Is there a way to solve this? I'd like ro force a reload of the
metaclass after 'debug' has been loaded and debug.DBG set to True,
but that doesn't seem to happen...

Any hints?

sandro
*:-)

sqlkit: http://sqlkit.argolinux.org
Nov 12 '08 #1
3 1698
On Nov 12, 9:38*am, sandro <san...@e-den.itwrote:
Hi,
Is there a way to solve this? I'd like ro force a reload of the
metaclass after 'debug' *has been loaded and debug.DBG set to True,
but that doesn't seem to happen...

Any hints?

sandro
*:-)

sqlkit: *http://sqlkit.argolinux.org
Look at the 'reload' function.
Nov 12 '08 #2
Aaron Brady wrote:
On Nov 12, 9:38*am, sandro <ssan...@e-den.it wrote:
>Hi,
Is there a way to solve this? I'd like ro force a reload of the
metaclass after 'debug' *has been loaded and debug.DBG set to True,
but that doesn't seem to happen...

Any hints?

sandro
*:-)
http://sqlkit.argolinux.orgttp://sqlkit.argolinux.org

Look at the 'reload' function.
That's exactely what I did but I get the followin error:

Traceback (most recent call last):
File "/home/misc/src/hg/py/pysia/program.py", line 123, in ore_mask
self.om = SqlMask(Class=Real, **self.meta)
File "/misc/src/hg/py/sqlkit/sqlkit/widgets/mask/mask.py", line 51, in __init__
sqlwidget.SqlWidget.__init__(self, *args, **kw)
TypeError: unbound method __init__() must be called with SqlWidget instance as first argument (got SqlMask instance instead)
(SqlMask inherits from SqlWidget)

?

sandro
*;-)
Nov 12 '08 #3
On Nov 12, 3:01*pm, sandro <san...@e-den.itwrote:
Aaron Brady wrote:
On Nov 12, 9:38*am, sandro <ssan...@e-den.it wrote:
Hi,
Is there a way to solve this? I'd like ro force a reload of the
metaclass after 'debug' *has been loaded and debug.DBG set to True,
but that doesn't seem to happen...
Any hints?
sandro
*:-)
http://sqlkit.argolinux.orgttp://sqlkit.argolinux.org
Look at the 'reload' function.

That's *exactely what I did but I get the followin error:

Traceback (most recent call last):
* File "/home/misc/src/hg/py/pysia/program.py", line 123, in ore_mask
* * self.om = SqlMask(Class=Real, **self.meta)
* File "/misc/src/hg/py/sqlkit/sqlkit/widgets/mask/mask.py", line 51, in __init__
* * sqlwidget.SqlWidget.__init__(self, *args, **kw)
TypeError: unbound method __init__() must be called with SqlWidget instance as first argument (got SqlMask instance instead)

(SqlMask inherits from SqlWidget)

?

sandro
*;-)
What did you do to merge the two packages?
Nov 12 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: Michele Simionato | last post by:
> Hello, my name is Skip and I am metaclass-unaware. I've been programming in > Python for about ten years and I have yet to write a metaclass. At first I > thought it was just that metaclasses...
5
by: Christoph Haas | last post by:
Dear coders... I'm working on an application that is supposed to support "plugins". The idea is to use the plugins as packages like this: Plugins/ __init__.py Plugin1.py Plugin2.py...
10
by: telesphore4 | last post by:
I want to inherit fresh copies of some class variables. So I set up a metaclass and meddle with the class variables there. Now it would be convenient to run thru a dictionary rather than...
6
by: Ben Finney | last post by:
Howdy all, I'm improving an existing application that's partly written using Python and the standard library. Many of the improvements I want to make can be done by using third-party free...
0
by: Jeff Rush | last post by:
Eggs are important to Python and will become more so over the next few years, if understood and embraced by the community. They are a key competitive feature - I've been asked so many times what...
13
by: PW | last post by:
Hi, This is bizarre. I've check and rechecked the spelling, cut and paste the name of the form (when trying to rename the form) and the control yet I still get a parameter prompt when the form...
15
RMWChaos
by: RMWChaos | last post by:
In my ongoing effort to produce shorter, more efficient code, I have created a "chicken and egg" / "catch-22" problem. I can think of several ways to fix this, none of them elegant. I want my code...
5
by: jryanfallon | last post by:
I am trying to write a program to sort eggs, extra eggs are discarded the program must have a pop up box for enter the eggs box type extra large - 12 dozen (144 eggs) large - 6...
6
by: Dave Challis | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm trying to write some code which: 1. Finds all modules in a plugin directory 2. Imports those modules 3. Creates an instance of each object...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.