57

Question being closed: Reading file using relative path in python project

  • Has a score of 124.
  • Has an accepted answer with a score of 205.
  • Has next answers with a total score of 56

Yet after 6 years it was closed as a duplicate by a single person (since that person has a gold tag badge).

Question marked as duplicate target: open() gives FileNotFoundError / IOError: Errno 2 No such file or directory

  • Has a lower score (115).
  • Has a lower score for the accepted answer (152).
  • Has a lower score for next answers as well (45).
  • Its top answer, while ok for that question, does not actually answer the question that got closed as duplicate.

The only point I see in favor of that decision is that the closed question is newer. Yet, the fact it got a higher score over 6 years than the second one over 10 years should hint that it is more useful to readers.

So, was closing the first question correct?
More generally is there a policy for which question to close as duplicate?
(I actually believe those are not duplicate here, but this got me curious)

Disclosure: as the author of the accepted answer to the first question, I have an obvious interest in seeing it reopened.

Still, it feels arbitrary and unfair. Especially considering no collaborative vote took place, and the person who closed it is not a neutral party, as they have posted their own answer to the second question.

12
  • 10
    One other metric you might consider when comparing the two questions is that the older post has 688k views (~180 views/day) while the newer post has 217k views (~94 views/day). Assuming these two posts are duplicates choosing the post with over 3 times as many views as the canonical might make sense as this is the post most people are engaging with. (I acknowledge you don't think these two posts are duplicates which is a separate issue to the direction of closure)
    – Henry Ecker Mod
    Commented Feb 8, 2023 at 1:49
  • 17
    I hope people don't downvote this question simply because they agree with my actions or think I shouldn't be called into question. It's important to have discussions like this, and I welcome review - as I just finished editing my answer to clarify, it's much harder to get feedback on these things than it ought to be. Commented Feb 8, 2023 at 2:59
  • 6
    Genuine question about your disclosure: how does it benefit you for the question you answered to be reopened? You can continue to get rep even though it's closed, right?
    – camille
    Commented Feb 8, 2023 at 5:11
  • 7
    @camille the "This question already has answers here <link>" panel sends people away before they read it. Not all people for sure but a significant part I reckon. After all that is why it is there.
    – spectras
    Commented Feb 8, 2023 at 6:03
  • 2
    I disagree that this is a duplicate. The other question asks if it's OK to close an older question as a duplicate of a newer one. The author of this question obviously knows that it's OK, since they're asking why a newer question was closed as a duplicate of an older one but with a lower score. Commented Feb 8, 2023 at 15:46
  • A different order of operations doesn't make the answer any different
    – Kevin B
    Commented Feb 8, 2023 at 16:20
  • 5
    @KevinB if we are in the spirit of the better content being the canonical then the duplicate target should actually be closed as a duplicate of this one, as Karl's answer is far more descriptive and better quality Commented Feb 8, 2023 at 16:38
  • @WhatsThePoint use your votes
    – Kevin B
    Commented Feb 8, 2023 at 16:47
  • 8
    @camille If someone visits a dupe from a search engine link and they aren't logged in, then they get automatically redirected to the dupe target, they don't even see the original page (although it will be listed in the Linked questions, but that list is generally very long on canonicals). OTOH, that doesn't affect most registered users, since we're generally logged in, so it has little affect on votes, but it does affect the viewcount, since ~90% of site traffic is from unregistered people using search engines.
    – PM 2Ring
    Commented Feb 8, 2023 at 19:24
  • 2
    @PM2Ring I didn't realize that. That seems like a pretty bad setup
    – camille
    Commented Feb 8, 2023 at 20:02
  • 1
    @camille I understand why it's set up like that, but I agree that it has downsides. It can be quite confusing to see part of a question in the Google preview, click on it, and end up on a totally different page...
    – PM 2Ring
    Commented Feb 8, 2023 at 20:09

2 Answers 2

64

that person

Nice to meet you.

Question statistics

Question and answer scores are definitely factors that can be taken into consideration. There are many more things I consider:

  • the question view count (which gives some indication of how good the title is at pulling in search engine traffic);

  • the number of linked questions (i.e., have people already been using the question as a duplicate target?);

  • the diversity of answers available (e.g. for a how-to question, I look for an answer section that covers all the natural approaches to the problem, and ideally isn't full of obscure or roundabout solutions);

  • my own subjective evaluation of the question and answer quality (i.e., how they're already written; I also do a fair bit of editing when there's something that can be easily fixed, but I'd rather not do a lot of work if I don't have to. After all, that risks accusations of going against the authors' intent.)

In theory, per the FAQ on SE, answer quality is the primary criterion; but I personally think there are good reasons not to give that too much weight. It also doesn't really say how to assess the answer quality. As a curator entrusted with the ability to do these things unilaterally, I generally trust my own judgment here; but I do take prior voting into consideration, and also solicit opinions from my peers. (See the last section for details.)

WRT question age:

The only point I see in favor of that decision is that the closed question is newer.

This is in fact not relevant, per policy.

Yet, the fact it got a higher score over 6 years than the second one over 10 years should hint that it is more useful to readers.

Arguably. These scores don't count anonymous feedback from logged-out users or users with low reputation who can't cast votes normally; it's known that these results can diverge significantly from the community. I'm not aware, however, of a way to view this information for a specific question, even with the 10k reputation "moderator tools". But yes, there is a valid argument there.

The matter of duplication

Its top answer, while ok for that question, does not actually answer the question that got closed as duplicate.

The duplicate target had already been established as the canonical for the underlying problem. I closed the other question as a duplicate because a) I recognized that the underlying problem was the same and b) it did not look like a better Q&A for the problem - mainly on the (lack of) strength of the question.

We want canonicals to explain the question concisely, because they will be viewed by a lot of people and we want those people to recognize quickly that their own problem matches. The closed question asks about a needlessly specific setup for the problem, which would alienate other readers.

That said, my considered opinion is that the canonical does answer the question being asked in the closed post. For reference, that is:

So it seems that the relative path used in open(...) is only relative to where the originating file is being run from (i.e __name__ == "__main__")? I don't want to use absolute paths. What are some ways to deal with this?

The answer, of course, is that it is relative to the program's current working directory; and that other than using absolute paths, it can be dealt with by changing the current working directory.

Meanwhile, the top answer on the canonical tells us:

Make sure you're in the directory you think you're in with os.getcwd() (if you launch your code from an IDE, you may well be in a different directory) You can then either: Call os.chdir(dir), dir being the folder where the file is located, then open the file with just its name like you were doing....

and:

A relative path is a path that does not start with your computer's root directory, and is instead relative to something called the working directory. You can view Python's current working directory by calling os.getcwd().

IOW: the relative path is relative to the program's current working directory; and in order to make it work, the current working directory has to match the directory you wanted to use. The answer also explains the tools needed both to check what that directory is and to change it. I don't understand how that could be argued not to be answering the question.

"But the OP of the closed question also wants to know specifically about setting the CWD based off the current script location" - well, no; the top answer inferred that that would be useful, it wasn't asked. But if it were asked, that would lower the quality of the question, by making it less focused (we also have a canonical specifically for getting the path of the current file's containing folder, and the rest is straightforward).

Re acting unilaterally etc.

no voting as that person has high reputation

In fact, the criterion is a gold badge in one or more of the tags initially used for the question - in this case, . This is supposed to indicate that I have the expertise needed to recognize duplicates like this.

I act unilaterally a lot of the time because there is a lot to do, and because I don't expect a lot of controversy on much of what I'm doing, and because it would often be difficult or time-consuming to reach any kind of consensus with others. (In general, posts on Meta that require subject-matter expertise to discuss, will not get much attention. Or so I'm told, anyway.)

I'm always happy to explain my reasoning (although it might take some time for me to get around to it, depending). Aside from Meta, I am the room owner for a chat room specifically about polishing up canonical questions for Python: https://chat.stackoverflow.com/rooms/247434/python-canon-discussion .

More generally is there a policy for which question to close as duplicate?

Not that I've been beaten over the head with yet. Certainly there are guidelines, and precedent, and a bunch of prior Meta questions about what to do in specific situations. I've even asked some of those. But outside of the FAQ it is pretty vague.

the person who closed it is not a neutral party, as they have posted their own answer to the second question.

I don't care about reputation. I have far more than is necessary to unlock every privilege afforded by the site (except, you know, the ones that require winning a community election). I put a ton of effort into that question - in order to ensure that all the information I thought was relevant for the question would be in a single answer, in a presentation style that I personally favour - to get a measly +2 out of it. It's honestly there more to collect related links, to help other curators close related questions.

I do, of course, like the idea of people seeing my answer and finding it useful; but that's because I genuinely do think it's useful. If I had decided that the other question was a better canonical, I would have migrated my answer to that question (and, if necessary, adapted it for the specific context of that question). Which is to say: I'm not motivated by trying to direct traffic to my answers; I'm motivated by trying to put my answers where they can be most useful.

26
  • 21
    Hello Karl. I believe the key motivation for actually asking here is what I ended with, the feeling of arbitrary and unfairness. I hope you understand how, from the other end of the website, seeing just the result can feel that way. I want to thank you for taking the time to explain. Knowing how you had thought about this topic and why you did things this way is probably the best I could have hoped for.
    – spectras
    Commented Feb 8, 2023 at 2:54
  • 16
    Sure thing. I got that impression, but I was ready to explain pretty much anything anyway, from the moment I realized it was my decision being called into question. Aside from defending my decisions and actions, I want to share my thoughts on the process anyway, in the hope that it helps other curators. Commented Feb 8, 2023 at 2:57
  • 9
    Well, now I understand it, I do not question it anymore. I do not entirely agree with the idea that a question that can be answered by combining two others is a duplicate, as I think asker's issue can lie in the decomposing/combining thought process. But I respect that point of view. And I believe the consistency that results from your dedicated effort to polish canonical questions matters much more than my personal take, so I am happy to leave it to you.
    – spectras
    Commented Feb 8, 2023 at 4:01
  • 5
    @spectras this is why you should assume good faith. Stack Overflow is complicated and unorthodox. Nothing wrong with asking for an explanation of course, there is no point in having to wonder about it. But if you don't approach it from an "is this wrong?" perspective but more from a "why was this handled this way?" perspective which is essentially the same question but without a pre-baked conclusion locked in, it just leads to more enjoyable meta posts that have more to do with explaining and less with redirecting. Look at this wall of text poor Karl had to write!
    – Gimby
    Commented Feb 8, 2023 at 10:16
  • 1
    @KarlKnechtel You can view anonymous voting information with SEDE. For example, this query.
    – wizzwizz4
    Commented Feb 8, 2023 at 12:36
  • 4
    @Gimby to be perfectly honest, I just write like this naturally most of the time. Commented Feb 8, 2023 at 15:04
  • 1
    FWIW, I agree that the dupe target you chose has a much more focused MRE, which is very important for a canonical.
    – PM 2Ring
    Commented Feb 8, 2023 at 19:18
  • 1
    @KarlKnechtel WRT canonicals, do you consider the particular angle the question was aimed at when closing / removing content in favor of a canonical? It seems to me like, with the reasoning you described, we are going into a direction of SO being an API reference instead of a Q&A. Commented Feb 9, 2023 at 20:48
  • 2
    FWIW, I feel the higher-voted answer is just plain better. It answers the question 99% of people are going to have in a more concise and to-the-point manner (literally the first sentence would solve the problem for most people). I greatly prefer it over the too-broad, catch-all answer of the dupe target and disagree muchly with the chosen dupe direction.
    – Clonkex
    Commented Feb 9, 2023 at 21:07
  • Would it be useful to merge the questions, which would move all of the answers from the duplicate to the main question? A moderator can do that easily. The only thing is that it literally moves all the answers without any obvious indication of where they came from, so it's only suitable when two questions are exact duplicates, not when they merely have the same solution.
    – Cody Gray Mod
    Commented Feb 9, 2023 at 22:56
  • Just want to pop in here and give some credit to @KarlKnechtel. They pinged me via a comment on a different Python Q&A I wrote a year or two ago, and mentioned that it was being discussed in chat. There's been some discussion about how to turn my Q&A into a canonical question (whether or not that means closing mine as a dupe). I think this sort of curation is important, and I wanted to say thanks for doing the work :)
    – Joundill
    Commented Feb 9, 2023 at 23:02
  • 1
    @CodyGray The problem I personally see here is that, so far, replacing questions with their canonical versions seems to ignore the particular viewpoint from which the question was asked. There's a huge difference between "When trying to do X I got an error E, how to fix it?" and "I'm trying to achieve X, I've got Y, what am I doing wrong?". The answer to the former should explain the issue in context of the error. The answers to the latter do not do that. Commented Feb 9, 2023 at 23:13
  • The combination of involved (has an answer) and unilaterial action seem clearly wrong. Would it really have killed you to put it to a vote instead? Why not make the assumption that you might be unknowingly biased and allow the designed-in confirmation to take effect?
    – Bill K
    Commented Feb 9, 2023 at 23:31
  • 1
    @KarlKnechtel That's fair, but the person who searches an error in Google does not necessarily want to know what is the right approach, but want to attain a deeper understanding of the problem behind the error. I've seen many closures that do not take that into account. Maybe you are aiming to be centralized, but have you considered it might be at the cost of useful information? Commented Feb 10, 2023 at 1:00
  • 1
    As for people searching an error message, there's often not a lot that can be done for them. In some cases, the same error can be caused by wildly different circumstances. This is a problem that I have been thinking about separately, especially for areas where there are no good canonicals and new content needs to be written. Commented Feb 10, 2023 at 1:05
9

Regarding highly up-voted/canonical duplicate closing in general:

  • Post age is irrelevant. The highest quality question with the highest quality answers should be the one with 'canonical' status.

  • Votes and views are mostly irrelevant, since they are as much a measurement of post age as of quality. But please be careful with closing highly up-voted posts, since a lot of people obviously found them helpful.

  • For determining the quality of the question itself in the context of "canonical" duplicates, it might be a bit of a paradox. Normally good questions SO are specific, describing the specific problem, with specific code examples.

    In the context of canonicals though, it might actually be helpful if the question is kept simple and general. Or otherwise answers will have to dig into specific details which might not be relevant for the big picture/FAQ part of the problem.

  • For determining the quality of the answers, there should ideally be at least one detailed answer completely covering all aspects of the question. That's an utopia however - more likely there are multiple questions that overlap, which address different aspects. Some answers may also be more up to date than others, in case the answer/best practice has changed since the time when the question was asked.

    And that's a problem with the SO format - a good canonical post shouldn't force the reader to search through multiple answers to get the complete picture. A good canonical post is not "fragmented" but contains at least one answer which is as close to completeness as possible.

    Which answer that was picked as accepted or how many answers there are, or if some answers are of low quality is irrelevant. Look at the best answer in terms of technical quality (not necessarily the most up-voted) and judge how good the post as whole is based on that.

My recommendation in moderating these kind of highly up-voted posts is that it should be done by someone with extensive domain knowledge, ideally a gold badge. And always leave a comment regarding why you decided to close it.

Please refrain from moderating such posts where you are partial: that is, you have written the question or one of the answers in the post you favour as canonical. There's no rule against doing so, but it is tasteful and avoids creating needless drama and accusations of favouring your own posts.

In the best of worlds, unilaterally "dupe hammering" these isn't ideal either. In theory it would be nice to first find some other gold badge holders (in the SO chat rooms etc) and try to come up with a consensus before picking which post to close. However, that may be difficult to achieve in practice. And sure, anyone with a gold badge can "unhammer" the post just as quick, but closing/re-opening over and over should be avoided.

6
  • 2
    Honestly I think you are drawing a false dichotomy between "specific" and "general". The kind of generality we want in canonicals is stuff like, asking about a sequence rather than a list, for a problem that happens to be solved the same way for any sequence and doesn't have meaningful list-specific optimizations. But we want specificity in the sense that special requirements (e.g. "preserve order" while removing duplicates) are called out, and assumed not to be required by default. (Yes, this means that sometimes the people who asked couldn't have known they got the scope exactly right.) Commented Feb 8, 2023 at 15:08
  • "And sure, anyone with a gold badge can "unhammer" the post just as quick, but closing/re-opening over and over should be avoided." It will actually only allow one "cycle", then I have to get someone else to help. Commented Feb 8, 2023 at 15:08
  • 2
    "And always leave a comment regarding why you decided to close it." I don't think that is necessary, nor constructive. I usually flag comments explaining close votes, upvotes, reopen votes, etc as "no longer needed". Comments are to provide feedback to a question or answers, i.e. to request clarification or suggest improvements. Commented Feb 10, 2023 at 16:50
  • 1
    @MarkRotteveel Unilaterally slamming a 100+ voted post closed without even leaving a note why is what's not constructive. It is fine to leave comments related to moderation, such as explaining why a post was closed.
    – Lundin
    Commented Feb 10, 2023 at 19:29
  • 2
    @Lundin the close reason itself is enough of a reason, regardless of how many misguided users decided to upvote it.
    – Kevin B
    Commented Feb 10, 2023 at 19:32
  • @KevinB That doesn't say anything at all. What I'm talking about is the somewhat exceptional situation of a single user closing a 100+ voted post as duplicate of some other 100+ votes post. Obviously you don't have to be misguided to upvote good content... again we are talking about duplicates.
    – Lundin
    Commented Feb 11, 2023 at 14:47

You must log in to answer this question.

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