Skip to content

Commit 1afd6f1

Browse files
committed
replace os.path with pathlib, afaik works better on Windows
1 parent 7437456 commit 1afd6f1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

opencage/command_line.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import argparse
22
import sys
3-
import os
43
import io
4+
from pathlib import Path
55
import re
66
import csv
77

@@ -72,9 +72,9 @@ def parse_args(args):
7272

7373
options = parser.parse_args(args)
7474

75-
if os.path.exists(options.output) and not options.dry_run:
75+
if Path(options.output).exists() and not options.dry_run:
7676
if options.overwrite:
77-
os.remove(options.output)
77+
Path(options.output).unlink()
7878
else:
7979
print(
8080
f"Error: The output file '{options.output}' already exists. You can add --overwrite to your command.",

0 commit comments

Comments
 (0)