Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7409245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:03:13+00:00 2026-05-29T06:03:13+00:00

I have a fair bit of experience with PHP frameworks and Python for scripting

  • 0

I have a fair bit of experience with PHP frameworks and Python for scripting so am now taking the step to Pyramid.

I’d like to know what is the ‘correct’ way to run a script in Pyramid. That is, how should I set it up so that it is part of the application and has access to config and thus database but does not run through paster (or whatever WSGI).

As an example, say I have a web application which while a user is offline grabs Facebook updates through a web service. I want to write a script to poll that service and store in the database ready for next login.

How should I do this in terms of:

  1. Adding variables in the ini file
  2. Starting the script correctly

I understand the basics of Python modules and packages; however I don’t fully understand Configurator/Paster/package setup, wherein I suspect the answer lies.

Thanks

Update:

Thanks, this seems along the lines of what I am looking for. I note that you have to follow a certain structure (eg have summary and parser attributes set) and that the function called command() will always be run. My test code now looks something like this:

class AwesomeCommand(Command):

max_args = 2
min_args = 2

usage = "NAME"
# These are required
summary = "Say hello!"
group_name = "My Package Name"
# Required:
parser = Command.standard_parser(verbose=True)


def command(self):

    # Load the config file/section
    config_file, section_name = self.args
    # What next?

I’m now stuck as to how to get the settings themselves. For example, in init.py you can do this:

 engine = engine_from_config(settings, 'sqlalchemy.')

What do I need to do to transform the config file into the settings?

EDIT: The (simpler) way to do this in Pylons is here:
Run Pylons controller as separate app?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:03:13+00:00Added an answer on May 29, 2026 at 6:03 am

    As of Pyramid 1.1, this is handled by the framework:

    http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/commandline.html#writing-a-script

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to Java (but have a fair bit of .NET experience). I
i've been using Nhibernate with LINQ a fair bit now and i have a
I have a fair bit of knowledge of Java and C#.NET (prefer C#). What
I have been using the Rails console a fair bit lately and its making
I've done a fair bit of UDP socket programming in the past, but have
I have very little programming knowledge; only a fair bit in Visual Basic. How
I have a fair number of Python scripts that contain reusable code that are
I have done a fair bit of googling on this and I can't find
I'm fairly new to MXML and Flash Builder with a fair bit of experience
Particularly I mean videos. I have fair bit of videos on my website and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.