5

While researching a problem I was running into, I recently came across this question, which describes the exact problem I was running into. It was at the time unanswered, so I posted my best solution I've been able to come up with. However, my solution is kind of hacky, and I'd really like a solution that doesn't delve into Python subprocess's private methods and depend on its internal state.

Generally, my next step would be to post a bounty asking for a less hacky solution, but the OP of that question tagged it with and I'm using . It just so happens my solution is applicable to both versions, but I wouldn't be surprised if the solution I'm looking for isn't, and I don't want my bounty to go to waste on the wrong problem.

What's my next step here?

  • The question is almost 8 years old, and has received absolutely no activity since it was originally posted. So maybe just edit the tags and post a bounty? But that seems questionable, and I doubt that edit would be approved.
  • Asking a new question that is nearly identical except the tag is changed (and I add info about my research, etc) seems like just asking for it to be closed as a duplicate, and I can't say I'd disagree with whoever did the closing. This meta question seems to recommend that approach, but since there is already an answer that works for both versions I'm worried it would be a duplicate, and this other meta question suggests different-language-version dupes are still dupes.
  • I could write a note in my bounty notice asking for python 3.6 answers, but it seems kind of weird to encourage people to post answers that might not work for the version the question is tagged with.
2
  • 2
    To me it sounds like your question is not a duplicate. According to my limited knowledge of Python, version 2 and 3 are quite different in many respects and not really (universally) backwards compatible. So, a Python 2 solution probably doesn't work for you.
    – VLAZ
    Commented Mar 31, 2021 at 8:44
  • @Tomerikoo that does seem like basically the same question. I wonder if the question I found should be a duplicate of it? Commented Mar 31, 2021 at 8:49

1 Answer 1

3

It seems that someone already asked a similar question almost a year ago. This question is only tagged and has 3 answers.

As I don't have a dupe-hammer I could only vote to close the older one as a duplicate and I think you should move your answer to the more recent one.

I know that it usually makes sense for dupes to be chronological (newer questions are duplicates of older ones), but in some cases as this one, the older one has practically zero activity while the new one - well, a lot more...

12
  • Should I just copy-paste the contents of my answer, or is there a way to get it moved? Commented Mar 31, 2021 at 8:52
  • 3
    Well since you don't have any votes on it yet, I would say just delete and re-post
    – Tomerikoo
    Commented Mar 31, 2021 at 8:53
  • 3
    The other question is different enough (asks for a limited set of processes, explicitly says not to use os.wait) that I'm just writing a new answer based on it and leaving the old one up. Commented Mar 31, 2021 at 9:09
  • 2
    "dupes should be chronological " Isn't the usual stance that the best/clearest/most detailed question should become the dupe target even if it might be newer? Commented Mar 31, 2021 at 9:50
  • 1
    In general, all Python questions should have the generic tag, not just a version-specific tag, so if you come across Python questions (that are worth keeping) that don't have the generic tag, please edit it in. That also applies to stuff like Pandas or Django questions that don't have any python tags at all.
    – PM 2Ring
    Commented Mar 31, 2021 at 10:15
  • @samcarter_is_at_topanswers.xyz I agree and this is what I advised to do and what I think should be the general rule. I only meant that it might feel logically "weird" because usually something new is already a duplicate of something existing. "How can an old question be a duplicate of a newer one if it was asked before?" - in SO it's possible if the new one has more helpful answers...
    – Tomerikoo
    Commented Mar 31, 2021 at 10:33
  • Makes sense... @GavinS.Yancey it seems to me that you just repeated the answer. Or at least kept the original inside the modified one. So can you please delete the original? This is an unnecessary duplication and whoever arrives to the old question will be redirected to the new one and see your answer there
    – Tomerikoo
    Commented Mar 31, 2021 at 10:46
  • I think it's ok to have an answer on the old one, but @Gavin should expand the answer on the new question. And perhaps explain a bit about the things that work on Python 2 vs 3. Using subprocess can be a little confusing, due to the various changes & additions.
    – PM 2Ring
    Commented Mar 31, 2021 at 10:49
  • @PM2Ring that seems a lot of work for not just simply have a single tag for all Python questions, since at the end that's what they should have.
    – Braiam
    Commented Mar 31, 2021 at 18:14
  • 1
    @Braiam That wouldn't work. Python 3 is not backwards compatible with Python 2. Depending on what you're doing, you may be able to write code that gives the same result in Py 2 or 3, but that's not always the case, and even when it is the code may be less efficient than version-specific code. If you're lucky, attempting to run code with the wrong version will fail, but it could run and give a different result, eg 9/2 gives 4 in Py 2 but gives 4.5 in Py 3.
    – PM 2Ring
    Commented Mar 31, 2021 at 19:07
  • (cont) One major difference is in Unicode handling, which had major flaws in Py 2, so a lot of Py 2 code that processes Unicode is buggy, and if it did work correctly it generally needs to be rewritten to run on Py 3.
    – PM 2Ring
    Commented Mar 31, 2021 at 19:08
  • @PM2Ring that's why you can add multiple answer to the same question. That would work perfectly. You don't need to have copies of the same "How to do X?" for both python 2 and 3 (or worse, for each X.Y version)!
    – Braiam
    Commented Apr 1, 2021 at 10:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .