#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    28
    Rep Power
    0

    Constructor not firing


    There must be something wrong with me. It's probably something I am not seeing right now and need someone else to look at. So what I did was 'porting' my project that I was working on earlier called Comodi, to the MVC framework, well kinda. So I begin with my bootstrap class and comodi.py that starts it all. I try to test it, but it isn't constructing my constructor in my Bootstrap class.

    comodi.py
    Code:
    import controllers
    import libs
    import models
    import views
    import libs.Bootstrap as libs_bootstrap
    
    print 'Starting bootstrap...'
    
    Bootstrap = libs_bootstrap.Bootstrap
    
    print str(Bootstrap)
    
    print 'Done'
    Bootstrap.py located in libs/
    Code:
    import models.lcd as model_lcd
    		
    class Bootstrap():
    	def __init__(self):
    		print 'Initializationssss!s!'
    		lcd = model_lcd.Adafruit_CharLCD()
    		lcd.lines('', ['Welcome to Comodi', True], ['Loading...', True])
    After a couple of checks just to be sure I found the following:
    • It is reading through the Bootstrap.py, it doesn't hang.
    • All of the modules are imported correctly.


    I do not get the output that I should get from the Bootstrap class (the print method doesn't fire, neither does the lcd show anything)

    Here are all the files and directories
    • controllers/
      • __init__.py
      • KEY_1.py
      • KEY_2.py
      • KEY_3.py
    • libs/
      • __init__.py
      • Bootstrap.py
      • Model.py
      • Controller.py
      • View.py
    • models/
      • __init__.py
      • date.py
      • lcd.py
      • irthread.py
      • mail.py
      • weather.py
    • views/
      • __init__.py
      • KEY_1.py
      • KEY_2.py
      • KEY_3.py
    • comodi.py
    • backup.py
    • __init__.py
    • LCD info.txt
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,995
    Rep Power
    481
    If f is a callable (classes, functions, methods, and objects with a __call__ method are callable)

    Then f is the callable

    and

    f(*args, **kwargs)

    invokes f .

    Therefor, I suppose you need

    Bootstrap = libs_bootstrap.Bootstrap()
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    28
    Rep Power
    0
    Originally Posted by b49P23TIvg
    If f is a callable (classes, functions, methods, and objects with a __call__ method are callable)

    Then f is the callable

    and

    f(*args, **kwargs)

    invokes f .

    Therefor, I suppose you need

    Bootstrap = libs_bootstrap.Bootstrap()
    Weird, I thought I tried that already. Thanks though. I knew it was something dumb.

IMN logo majestic logo threadwatch logo seochat tools logo