Skip to content

Commit

Permalink
Fix broken sys.argv check
Browse files Browse the repository at this point in the history
Closes #16
  • Loading branch information
abdnh committed Nov 26, 2022
1 parent a80ecd2 commit 81f2865
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.2.1] - 2022-11-27

### Fixed

- Fix a critical error preventing the add-on from working in most situations (https://github.com/abdnh/anki-zim-reader/issues/16).

## [1.2.0] - 2022-11-23

### Added
Expand Down
7 changes: 1 addition & 6 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import sys
from pathlib import Path

if sys.argv[1] == "serve":
from .server import serve_file

serve_file(Path(sys.argv[2]))
elif "pytest" not in sys.modules:
if "pytest" not in sys.modules and "anki" in sys.modules:
from . import main
7 changes: 7 additions & 0 deletions src/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import sys
from pathlib import Path

if len(sys.argv) > 1:
from .server import serve_file

serve_file(Path(sys.argv[1]))

0 comments on commit 81f2865

Please sign in to comment.