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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:42:15+00:00 2026-06-17T06:42:15+00:00

This script was supposed to be a quick Clearcase supporting script, it’s my first

  • 0

This script was supposed to be a quick Clearcase supporting script, it’s my first go at Python as I decided to dump Perl.

subprocess.Popen/communicate is called to run a Clearcase command that returns an empty string, however I am completely unable to accurately test for this returned value:

import subprocess
import sys

# cleartool descr -fmt "%Sn" foo.c
# returns the version number of the file if it's under CC control:
#        b'"\\main\\hb_clearcase\\oint_uas_umac_03\\25"'
# or nothing if it's hijacked.
std_out = subprocess.Popen(['c:/rational/clearcase/bin/cleartool', 'desc',
                 '-fmt', '"%Sn"', 'foo.c'], stdout=subprocess.PIPE).communicate()
std_out = std_out.decode("utf-8")

print(std_out)
# prints:  ""

# Here it goes wrong, I have tried many options in the if...  
# The file IS hijacked, the std_out string IS empty.
if std_out == "":
    print('File is hijacked')
else
    print('File is not hijacked')

The wonder is the difference in the if std_dev == "" comparison’s behaviour between running the script directly in a DOS box or in PyDev in Eclipse. They seem to always return the opposite result. As it is above this works as expected (ie. hijacked) on PyDev, fails in the command prompt. Make the comparison if std_dev == '""' and PyDev delivers the expected result, but not the command prompt.

This is the latest Python 3.3 on Win7 and I expected to have nailed this script hours ago.

What on earth am I doing wrong?

  • 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-17T06:42:16+00:00Added an answer on June 17, 2026 at 6:42 am

    First of all, good choice to stick to Python (see this, especially the “Alt” text when you mouse-over the cartoon).

    Maybe you could try:

    if std_out.strip("\"").strip() == "":
    

    This will make strings like '""' and ' ""' all be like “”.

    Anyway, it sounds strange to me that PyDev gives a different result.

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

Sidebar

Related Questions

I have a Perl script, that's supposed to match this string: Sometimes, he says
I have this python script which is supposed to wrap all that look like
I'm trying to design this script that's supposed to be used as a part
I got this script off 9lessons.info and it is supposed to auto suggest friends
i just installed python i am trying to run this script: import csv reader
I have a quick Jquery question .. This Jquery code is supposed to show
I have a perl script running on a Debian virtual machine on VMWare. This
I have this script that is supposed to insert the information into a MySQL
This script is supposed to to get a multidimensional array and iterate through the
This bash script is supposed to remove leading whitespace from grep results: #!/bin/bash grep

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.