Menu

[Python SUIT] I'm Pretty Confused, Beginner

Help
Anonymous
2010-07-01
2013-05-02
  • Anonymous

    Anonymous - 2010-07-01

    Perhaps my main problem is that I can't use easy_install. My host is Dreamhost. As a result, I'm trying to just import the folder. I had it in my /home/ folder for a while, but it didn't work. Now I've put it in the main website folder in a folder called SUIT and it still doesn't work. Here is the error via cgitb. rulebox is a folder in the same directory as SUIT. I'm just not at all sure why it's not working.

    1
    2
    3
    4
    5
    6
    7
    8
    #!/usr/bin/env python
    import cgitb, sys
    cgitb.enable()
    import SUIT
    from rulebox import templating
    template = open('template.tpl').read()
    templating.var.username = 'usernamed'
    print suit.execute(templating.rules, template)
    
     
  • Null

    Null - 2010-07-02

    Well, it seems you do not have the simplejson module installed.  You need to set yourself up with simplejson, considering your host uses Python 2.5.

     
  • Brandon Evans

    Brandon Evans - 2010-07-02

    Yes. The default json module was added in 2.6, and besides, simplejson is more efficient. Once you have that installed, that exception should disappear.

    As far as placing the packages, however, your host probably has some sort of "lib" folder in the Python path for Python packages, which would be the most optimal place to put these things. As far as I know, easy_install's primary function is to copy a package to that directory, so to do this manually, you might want to find such a directory. This way, you can import both suit and rulebox from any python file, regardless of where it is located relative to them.

    Thank you for using SUIT! Let us know if you've gotten set up.
    Brandon

     
  • Anonymous

    Anonymous - 2010-07-02

    Eheheh, this is kind of a headache. I've put simplejson in my /python/ directory (which I had to create, strangely, and use sys.path.append()). It works as far as I can tell. :)

    Strangely, there's another problem. From what I gather, it's not recognizing that there's an execute method, which there obviously is. I'm not sure why, although I think I should probably know why. :|

     
  • Null

    Null - 2010-07-03

    What are the contents of your suit/__init__.py file?  Paste its contents on a Pastebin website.

    simplejson is more efficient

    Python 2.6's JSON == simplejson, only differences being that simplejson works for past Python versions and that it is updated more frequently than the Standard Library.  -___-

     
  • Anonymous

    Anonymous - 2010-07-03

    The __init__.py file is the same as that of the rulebox folder, because suit didn't have one when I downloaded it so.

    # -*- coding: utf-8 -*-
    # This program is free software: you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU General Public License for more details.
    # You should have received a copy of the GNU General Public License
    # along with this program.  If not, see <http://www.gnu.org/licenses/>.

    # Copyright (C) 2008-2010 Brandon Evans and Chris Santiago.
    # http://www.suitframework.com/
    # http://www.suitframework.com/docs/credits

    """
    A package containing various sets of rules for use with SUIT.


    Example Usage

    ::

        import suit # easy_install suit
        from rulebox import templating
        template = open('template.tpl').read()
        # Template contains "Hello, <strong>username</strong>!"
        templating.var.username = 'Brandon'
        print suit.execute(templating.rules, template)
        # Result: Hello, <strong>Brandon</strong>!

    Basic usage; see http://www.suitframework.com/docs/ for other uses.
    """

    __version__ = '1.0.0'

     
  • Anonymous

    Anonymous - 2010-07-03

    Oh, I'm sorry. I forgot to post it on Pastebin.

     
  • Anonymous

    Anonymous - 2010-07-03

    That's weird. The pastebin url didn't go. here it is :).

     
  • Null

    Null - 2010-07-03

    As I thought; your SUIT module file has no code in it, for some strange reason.  Please replace the contents of your entire file with this paste:  http://paste.pocoo.org/show/233021/

    Please verify your rulebox files are also complete and up to date.

     
  • Anonymous

    Anonymous - 2010-07-03

    I added the code that you provided, but there's a new error. By verifying that the rulebox files are up to date, you mean download them again or what? (I did.) I'm going to ask some questions to clarify some things, because I'm not clear with importing and whatnot.

    1.) Should there be a suit.py file inside the suit folder, or just an __init__.py file?
    2.) Does the code you provided in your previous post get pasted into __init__.py or into suit.py?

     
  • Brandon Evans

    Brandon Evans - 2010-07-03

    Revert your __init__.py file. You pasted rulebox/__init__.py. He's referring to suit/__init__.py, which is the easy_install equivalent of suit.py. So, change that back, and now, let me tackle the original error.

    This error has nothing to do with SUIT. It has to do with the json module not containing the function we need. Why? Not sure. You should paste the simplejson file.

    Brandon

     
  • Anonymous

    Anonymous - 2010-07-06

    Simplejson's __init__.py: http://pastebin.com/VpaRyeRX

     
  • Brandon Evans

    Brandon Evans - 2010-07-06

    In fact, the heading for that file says it's a part of SQLAlchemy…I'll presume you pasted the wrong file? Or are those the actual, incorrect contents?

     
  • Anonymous

    Anonymous - 2010-07-08

    This problem is resolved, thanks to Faltzer spotting my biggest silly. No content-type header. :|

     
  • Brandon Evans

    Brandon Evans - 2010-07-09

    That's the thing that bothers me about being a new open source program. People tend to assume that because it's new, it hasn't been throughly tested, and they are quicker to blame the project instead of their implementation.

    Let me assure you, we have worked on this thing for nearly 2 years, and I, being an obsessive perfectionist, have put SUIT through nearly every imaginable scenario. It's virtually unbreakable. I'd love you to prove me wrong, though. :P

    That aside, good to hear that everything is working. I hope you continue using and supporting SUIT, and be sure to come back if you have any other problems!

    Brandon

     

Log in to post a comment.