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 6213139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:38:32+00:00 2026-05-24T06:38:32+00:00

I have to make graphs from several files with data. I already found a

  • 0

I have to make graphs from several files with data. I already found a way to run a simple command

xmgrace -batch batch.bfile -nosafe -hardcopy

in which batch.bfile is a text file with grace commands to print the graph I want. I already tried it manually and it works perfectly. To do this with several files I just have to edit one parameter inside batch.bfile and run the same command every time I make a change.

I have already written a python code which edits batch.bfile and goes through all the data files with a for cycle. In each cycle step I want to run the mentioned command directly in the command line.

After searching a bit I found two solutions, one with os.system() and another with subprocess.Popen() and I could only make subprocess.Popen() work without giving any errors by writing:

subprocess.Popen("xmgrace -batch batch.bfile -nosafe -hardcopy", shell=True)

Problem is, this doesn’t do anything in practice, i.e., it just isn’t the same as running the command directly in the command line. I already tried writing the full directory for the batch.bfile but nothing changed.

I am using Python 2.7 and Mac OS 10.7

  • 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-24T06:38:33+00:00Added an answer on May 24, 2026 at 6:38 am

    Have you checked running xmgrace from the command line using sh? (i.e. invoke /bin/sh, then run xmgrace… which should be the same shell that Popen is using when you set shell=true).

    Another solution would be to create a shell script (create a file like myscript.sh, and run chmod +x from the terminal). In the script call xmgrace:

    #!/bin/bash
    xmgrace -batch batch.bfile -nosafe -hardcopy
    

    You could then test that myscript.sh works, which ought to pick up any environment variables that might be in your profile that might differ from python. If this works, you could call the script from python’s subprocess.Popen(‘myscript.sh’). You can check what the environment variables are set in python for subprocess by running:

    import os
    os.environ
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to make a schema for an XML format that's already being used.
I have to make a connection to an XMLRPC site from a web application,
I have to make a simple layout in android but have problem with the
I have a website that currently takes data from a mysql database and using
I have some data from a database (SQLite), mapping a value (an integer) to
I am doing some queries from a database to make graphs, and a graph
I have an air app that collects live data from a user's action and
Do you have any insights into the most elegant way of persisting objects from
I have to make column charts in Excel using VBA only (no user input).
I have to make a graphical user interface application using the language of my

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.