nigyta / dfast_core

DDBJ Fast Annotation and Submission Tool
76 stars 14 forks source link

Problem running test with python3 #5

Closed seth-1 closed 6 years ago

seth-1 commented 6 years ago

Hi @nigyta,

Thanks for making the package available on Github. I wanted to try it out and experienced problems when performing a test run.

'''python Traceback (most recent call last): File "/Users/s/dfast_core/dfast", line 115, in config = load_config(app_root, config_file) File "/Users/s/dfast_core/dfc/utils/config_util.py", line 28, in loadconfig return module.Config AttributeError: module 'Config' has no attribute 'Config' ''' I inspected the config object on line 20 in '''config_util.py''' and it seems fine. But then in the following lines '''machinery.SourceFileLoader''' might not work.

Do you know what I can try to make it work? I'm using python version 3.6.4.

Best regards,

Sebastian

nigyta commented 6 years ago

Dear Sebastian,

Thank you for trying DFAST.

I tried to reproduce the error using Python 3.6.4 on both Mac and Linux, but so far I couldn't.

Probably, you can avoid the error by replacing the "load_config" method in "dfc/utils/config_util.py" with the following:

def load_config(app_root, config_file):
    logger.info("Running on Python {}.".format(sys.version))
    logger.info("Loading a config file from {}".format(config_file))

    config = open(config_file).read()
    config = config.replace("@@APP_ROOT@@", app_root)
    exec(config, globals())  # Config object will be imported
    return Config

Hopefully, it works. I will fix this part in the future version.

Also, could you let me know the command you used to launch the program? It may help me figure out the problem.

Yasuhiro / @nigyta

seth-1 commented 6 years ago

Hi Yasuhiro,

Thanks for the fast reply! Replacing the part of the load_config function with the snippet you provided fixed the issue. I can now complete the test run.

I used the command mentioned in the README (dfast added in my PATH):

dfast --config dfast_core/example/test_config.py

Thanks for the help!

Sebastian

nigyta commented 6 years ago

Thank you for letting me know. I've updated the source code, although I'm still not sure why this error happened.

If you have any question or inquiry, please feel free to ask again.