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

  • Home
  • SEARCH
  • 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 8666033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:37:44+00:00 2026-06-12T17:37:44+00:00

I am new to Django. I would like to run some command from some

  • 0

I am new to Django. I would like to run some command from some view. Something like:

 python /path/to/the/script/run.py -id 11 --user root --run_digital_id 29 --workflow map --lib_group library.yaml --log log.conf

I use this method to call:

def run_in_background(cmd):
    logging.info('running ' + cmd)
    p = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
    output, errors = p.communicate()
    print output
    print errors
    logging.debug(output)
    logging.debug(errors)

The command is passed to the method run_in_background(). When I copy the command and run on the terminal, it works well. But when I run it from some view of Django, it reports:

Traceback (most recent call last):
  File "/path/to/the/script/run.py", line 11, in ?
    import conf, util
  File "/path/to/the/script/conf.py", line 11
    class Settings():
                   ^
SyntaxError: invalid syntax

Er, the run_in_background method is also working when I call it from some ‘plain’ python code.

The error position is the first line of my program. I suspect there is something wrong with the paths… But after searching for long time, I did not get the reason. Please help. Thanks.

  • 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-06-12T17:37:45+00:00Added an answer on June 12, 2026 at 5:37 pm

    Seems like this is the solution!

    In some python version defining class with empty parenthesis like class Settings(): is not valid, you may want to change it to class Settings(object):

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

Sidebar

Related Questions

I'm new with Django and this question is probably very basic. I would like
I'm quite new to Django & Tastypie. I would like to return only one
We are new to the python world and would like to get started a
I am designing a new GAE python application and would like to design it
From a Django template, I would like to include an html snippet from a
I have a django view that looks like... def add_user(request): if User.objects.get(username__exact = request.POST['username']):
I'm trying to learn Django and I would like feedback from anyone who has
I am new to Django and would like to know what is the Django-way
Am new to django, and i would like to add a column to a
Relatively new to Python.. I would like to know how to check if a

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.