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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:20:41+00:00 2026-05-31T05:20:41+00:00

According to python docs http://docs.python.org/library/subprocess.html , it’s recommended to replace os.popen with the Popen

  • 0

According to python docs http://docs.python.org/library/subprocess.html, it’s recommended to replace os.popen with the Popen class, right now I have the following command:

import os
c = "openssl dgst -sha1 -sign /foo/1 /bar/1 | openssl enc -base64 -A"
my_value = os.popen(c).read()

I understand that Popen takes the command as a list of string arguments, how ever it breaks when I try to pass pipe (“|”), I also understand this is caused because “|” has a special meaning in bash, how ever not sure how to solve this issue.

The other issue is Popen instances don’t have read method so I’m not sure what is the way to see the output.

I am using Django Framework, so If there is also a function in the framework that may help is also an option.

  • 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-31T05:20:42+00:00Added an answer on May 31, 2026 at 5:20 am

    If you take a look at the Replacing the shell pipeline section in the documentation, you’ll see that your example could be written as follows using subprocess:

    from subprocess import Popen, PIPE                                        
    p_dgst = Popen("openssl dgst -sha1 -sign /foo/1 /bar/1".split(),
                   stdout=PIPE)
    p_enc =  Popen("openssl enc -base64 -A".split(),
                   stdin=p_dgst.stdout, stdout.PIPE)
    my_value = p_enc.communicate()[0]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to http://docs.python.org/dev/library/plistlib.html , plistlib is available to non-Mac platforms only since 2.6, but
In the python documentation for struct, the word buffer is used without explanation: http://docs.python.org/library/struct.html
Using this example from http://docs.python.org/tutorial/classes.html#class-objects : class MyClass: A simple example class i =
According to http://www.faqs.org/docs/diveintopython/fileinfo_private.html : Like most languages, Python has the concept of private elements:
I am new to python and graphics but have programmed before. According to http://en.wikipedia.org/wiki/Transformation_matrix#Rotation
According to the Python 2.6.5 docs [1], the bsddb module has been deprecated for
I am trying to overload operators of a C++ class using Boost.Python. According to
I recently came across the pandas library for python, which according to this benchmark
I am trying to install python bindings for the enchant library (pyenchant), according to
According to the Python docs , ast.Print takes an optional, boolean nl argument. What

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.