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

The Archive Base Latest Questions

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

Ubuntu Server 9.10, Here is my file, test.py import commands blkid = commands.getoutput(‘blkid’) print

  • 0

Ubuntu Server 9.10,
Here is my file, test.py

import commands
blkid = commands.getoutput('blkid')
print blkid

When I manually run (as SU) this:

python test.py

I get the output of the blkid as expected:

/dev/sda1: UUID="3f0ac5bb-f0da-4574-81f5-77844530b561" TYPE="ext4"
/dev/sda5: UUID="67df0e7c-74fb-47dd-8520-ad720fbed67d" TYPE="swap"
/dev/sdb1: UUID="85466892-8dae-461c-95da-b8f91c2e766b" TYPE="ext3"
/dev/sdc1: UUID="91b84635-21c2-4d9a-84f8-2bbaab16d41f" SEC_TYPE="ext2" TYPE="ext3"
/dev/sdd1: UUID="6a52c830-0029-4154-80cb-f17274eb6fed" SEC_TYPE="ext2" TYPE="ext3"

However when I add this to my SU crontab:

* * * * * python /home/myusername/test.py > /home/myusername/output

The content of output becomes:

sh: blkid: not found

What am I missing here? Is the Python commands module only for certain SH-specific commands? I’m just try to run a system command and capture the output into a variable that I can parse.

  • 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-13T21:40:29+00:00Added an answer on May 13, 2026 at 9:40 pm

    The problem is probably with your $PATH versus root’s (os.environ['PATH'] if you’re looking at it in Python rather than shell;-). root’s PATH is typically very conservative (it would be risky for it NOT to be!) and since you’re running blkid without specifying an absolute path that may easily mean that it’s on your PATH but not root’s.

    So do which blkid as yourself at a shell prompt, sudo su or anyway become root, and echo $PATH — you can rapidly verify the problem. Then you fix it by using blkid’s absolute complete path in the getoutput call rather than just the bare identifier blkid as you’re doing now.

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

Sidebar

Related Questions

I am working in ubuntu server 10.04 I am creating a test.h file which
I using a new server (Rackspace, Ubuntu 10.04) trying to run a php file
I need to set up an amazon server. I always here setup ubuntu on
Hi recently I conducted a test on two different ubuntu servers. Here are the
I just installed Glassfish on my Ubuntu server (No GUI) using THIS tutorial. Everything
Why when use Youtube-dl on linux ubuntu server many link generate this output? [youtube]
I followed the guide here http://www.hackido.com/2010/01/installing-git-on-server-ubuntu-or.html but I cannot find the proper way to
I am trying to run a Rails two app with Ubuntu 10.04 server, sphinx,
This server runs on Ubuntu 10.04, particularly on Linode VPS. Passenger Error: A source
I'm currently studying Ubuntu Server administration, and also HTML/CSS. When it comes to the

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.