Skip to content

[CLOSED] script should work without config.ini #20

Description

@voiskiTest

Issue by midenok
Friday Nov 15, 2013 at 14:39 GMT
Originally opened as IQAndreas/github-issues-import#20


Now it fails with some ugly stacktrace:

$ ./gh-issues-import.py -s lkde/git -t learn-it/scripting --issues 5
Traceback (most recent call last):
  File "./gh-issues-import.py", line 54, in init_config
    config_file = open(config_file_name)
IOError: [Errno 2] No such file or directory: '/home/user/src/github/github-issues-import/config.ini'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./gh-issues-import.py", line 369, in <module>
    issue_ids = init_config()
  File "./gh-issues-import.py", line 56, in init_config
    except FileNotFoundError:
NameError: global name 'FileNotFoundError' is not defined
Expected behaviour:

Ask username and password from terminal and proceed further.

Activity

  1. voiskiTest commented on Nov 10, 2017

    @voiskiTest
    OwnerAuthor

    Comment by IQAndreas
    Sunday Nov 17, 2013 at 09:20 GMT


    Thanks for the bug report, I fixed the problem in b25a2fb

    Now you only get a friendly notice from the script if it couldn't find the default config file (just in case someone forgot to name it config.ini, or put it in the wrong folder).

    I also added the option --config none for if you have created the default config file, but want to ignore it anyway. (On the off chance that your config file is actually named none, use the argument --config "./none")

  2. voiskiTest commented on Nov 10, 2017

    @voiskiTest
    OwnerAuthor

    Comment by midenok
    Sunday Nov 17, 2013 at 15:04 GMT


    In fact, the behavior you invented is not very well.

    1. Notification of absent config.ini is needless, it will be obvious to user in any case. The notification will be nagging to those who don't use config.ini.
    2. Options from command-line should override options from config.ini, so --config none is useless.
  3. voiskiTest commented on Nov 10, 2017

    @voiskiTest
    OwnerAuthor

    Comment by IQAndreas
    Monday Nov 18, 2013 at 14:48 GMT


    The notification will be nagging to those who don't use config.ini.

    You are right, I will go ahead and remove the big WARNING from the output.

    However, I will leave the "No default config found" message in, just in case a user forgets to rename the config file (it may not always be very clear to them. All they get is the script asking them for information they supposedly already wrote).

    Options from command-line should override options from config.ini, so --config none is useless.

    Well, there are some options which cannot be set (and therefore not overidden) from the command line (such as date format, template settings, or if a repo is hosted somewhere else than GitHub). Just in case someone uses the script more than once and has the old config file still laying around, I don't want that old config to accidentally interfere in their second project.

    Regardless, that flag is entirely optional, and it's better to just have it there in case it is ever needed.

  4. voiskiTest commented on Nov 10, 2017

    @voiskiTest
    OwnerAuthor

    Comment by midenok
    Monday Nov 18, 2013 at 15:05 GMT


    Well, there are some options which cannot be set (and therefore not overidden) from the command line (such as date format, template settings, or if a repo is hosted somewhere else than GitHub).

    Well, you have such options... Ok, I was not aware of them. Then, indeed, you should have such setting. Please, consider not to mix different semantics into same --config. Maybe better is to do different setting like --no-config, --without-config, --pure, --virgin or just -C.

  5. voiskiTest commented on Nov 10, 2017

    @voiskiTest
    OwnerAuthor

    Comment by IQAndreas
    Monday Nov 18, 2013 at 16:44 GMT


    Maybe better is to do different setting like

    Perfect! I replaced the existing behavior with a new --no-config flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions