Skip to content

Commit

Permalink
Merge pull request #367 from widdowquinn/issue_130
Browse files Browse the repository at this point in the history
Issue #130: Add `try/except` to catch `ModuleNotFoundError` when no `openpyxl`
  • Loading branch information
baileythegreen authored Jan 24, 2022
2 parents 0a6c74e + 630bcfd commit b8722f0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pyani/pyani_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"""Module providing functions for presenting analysis/db output."""

import sys
import logging

from pathlib import Path
from typing import Any, Dict, List, Optional, Sequence
Expand Down Expand Up @@ -202,6 +203,8 @@ def write_dbtable(
colours are used for identity/coverage tables
"""
logger = logging.getLogger(__name__)

formatdict = {
"tab": (dfm.to_csv, {"sep": "\t", "index": show_index}, ".tab"),
"excel": (dfm.to_excel, {"index": show_index}, ".xlsx"),
Expand All @@ -215,4 +218,9 @@ def write_dbtable(
for fmt in formats:
func, args, ext = formatdict[fmt]
ofname = path.with_suffix(ext)
func(ofname, **args)
try:
func(ofname, **args)
except ModuleNotFoundError as e:
logger.warning("ModuleNotFoundError: %s", e)
logger.warning("Skipping %s output", fmt)
continue

3 comments on commit b8722f0

@jianshu93
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the help info is still the old version, fastani option is not available.

Jianshu

@baileythegreen
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the help info is still the old version, fastani option is not available.

Jianshu

Hi jianshu93, I don't think this is where you meant to post this, but—fastANI is only available on v3, and must be installed from github, rather than something like conda. v2 is no longer under active development, and I know of no plans to add fastANI support to that version.

@widdowquinn
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be clear, v2 is receiving bug fixes.

Please sign in to comment.