https://askubuntu.com/questions/749670/open-file-edit-and-close-with-python/749676#749676 is being closed.

Sure, it's a really, really bad question. Sure, he's not researched it. But it's not off topic.

The close reason being chosen:

This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow.

His question:

I need a program to search for a file in folder. The code should open that file, change the content and close.

The OS is Ubuntu, I need to write this in Python.

The Help Centre:

Questions that you may ask:

  • Running third-party applications on Ubuntu.

  • Development on Ubuntu.

  • Services provided by Ubuntu and Canonical.



1 Answer 1


No, that kind of questions shall be shot on sight.

It's a homework programming question.

Homework questions are ok (at least IMO) when:

  1. They're explained well enough. That's the bare minimum for any question. Otherwise, close as "unclear what you're asking". That question barely meets this requirement doesn't meet this requirement at all.

  2. It's clear that OP at least tried to solve the problem alone. That question doesn't meet this requirement.

Pure programming questions instead are just not ok. They're off-topic. Python is a programming language, and we close question about Python that have nothing to do with Ubuntu: the answer that question would receive here isn't different from the answer it'd receive on Stack Overflow (leaving aside for a moment that it would be buried under downvotes and closed on Stack Overflow as well) and it's not specific to Ubuntu at all.

Mind that shell scripting questions are an exception to this. Shell scripting questions are on-topic and welcome here.

You're overreading the statement in the Help Center: "Development on Ubuntu" shall be read as in "What concerns development on Ubuntu", or of course as in "Development that is specific to the Ubuntu platform": more info here (thanks muru).

To make this clearer, other than questions about development that is specific to the Ubuntu platform (it's hard to make a detailed resume of all the possible approriate questions, but for example questions about platform-specific APIs) here are some sample questions that would be on-topic:

  • My code needs library X in order to run. Which package provides library X?
  • My code needs library X.1 in order to run. Library X.1 is installed but an older version of the library (X) is loaded instead. How do I force Ubuntu to load X.1 instead of X?
  • I usually read "development on Ubuntu" to mean development on the Ubuntu platform, the SDK, QML, all that. That's specific to Ubuntu, most of the others really aren't and should really be asked on Stack Overflow. Kernel module programming really doesn't belong here, nor does debugging programs (shell scripts being the exception).
    – muru
    Commented Mar 24, 2016 at 21:49
  • @muru That is indeed on-topic as well (actually way more than what I mentioned so far. I'll add that).
    – kos
    Commented Mar 24, 2016 at 22:15
  • "most of the others" was wrong, I was just talking about general debugging and kernel module programming.
    – muru
    Commented Mar 24, 2016 at 22:18
  • @muru I don't know if there could be reasons for a kernel module to not compile on Ubuntu. However in the example I didn't mean to imply "kernel programming", perhaps #3 in essence can only be just a different wordings of #1 / #2 (as I'm not sure if there could be reasons for a kernel module to not compile on Ubuntu aside from libraries). In doubt I'll just remove it, it's not important.
    – kos
    Commented Mar 24, 2016 at 22:19
  • Iirc Ubuntu, like many other distros, apply patches to the kernel. Who knows if one those patches breaks some behaviour $RANDOM_DEV's $RANDOM_MODULE relies on. Either it's a bug (then it should be on Launchpad) or they want to debug it (then they should ask on Stack Overflow).
    – muru
    Commented Mar 24, 2016 at 22:23
  • If you add that bit about the SDK etc., consider linking to developer.ubuntu.com/en/start/platform
    – muru
    Commented Mar 24, 2016 at 22:25
  • @muru Ok I see, I guess that's accurate. Seems reasonable, thanks, done.
    – kos
    Commented Mar 24, 2016 at 22:41
  • It is pretty clear what he wants... he lays it out really clearly. I'm not saying it's good, but close votes are the wrong gun to shoot with...
    – Tim
    Commented Mar 24, 2016 at 23:14
  • @Tim Sorry, but it's not clear what they want. "I need a program to search for a file in folder." - cool. "The code should open that file, change the content and close." - "change the content": it misses what content and to what content. If they want a general method they're on the wrong site, because we don't teach Python. And anyway even being specific that question would be off-topic simply for the fact that it asks specifically for Python.
    – kos
    Commented Mar 24, 2016 at 23:29
  • @kos I'm pretty sure Python is on topic here... meta.askubuntu.com/a/13808/186134 is one e.g.
    – Tim
    Commented Mar 24, 2016 at 23:30
  • @Tim The problem is not Python, is the fact that the question is about general programming that is not specific to Ubuntu at all. Mind showing me a proof of a general Python programming question still open? (but trust me, if there is it will be closed).
    – kos
    Commented Mar 24, 2016 at 23:34
  • @kos askubuntu.com/q/745955/186134
    – Tim
    Commented Mar 24, 2016 at 23:37
  • I'm not sure why you're debating this... the help center says "Development on Ubuntu" how much clearer do you want? Not scripting, Dev...
    – Tim
    Commented Mar 24, 2016 at 23:37
  • @Tim I don't personally have an interest in debating this, we can stop here. I was trying to explain to you where you're getting this wrong. The question you linked asks how to force Ubuntu to always use Python 3, and, please think about this, has nothing to do with general programming.
    – kos
    Commented Mar 24, 2016 at 23:47

You must log in to answer this question.

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