mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Fix way to handle OSError (error doesn't exist)
A better way would to use sys.stderr.write or PY3 print(file=sys.stderr)
This commit is contained in:
parent
c4f96b108f
commit
fec605b577
1 changed files with 3 additions and 2 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from codecs import open
|
from codecs import open
|
||||||
|
|
@ -259,14 +260,14 @@ def main():
|
||||||
elif args.feed:
|
elif args.feed:
|
||||||
input_type = 'feed'
|
input_type = 'feed'
|
||||||
else:
|
else:
|
||||||
print("you must provide either --wpfile, --dotclear or --feed options")
|
print("You must provide either --wpfile, --dotclear or --feed options")
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
if not os.path.exists(args.output):
|
if not os.path.exists(args.output):
|
||||||
try:
|
try:
|
||||||
os.mkdir(args.output)
|
os.mkdir(args.output)
|
||||||
except OSError:
|
except OSError:
|
||||||
error("Couldn't create the output folder: " + args.output)
|
print("Unable to create the output folder: " + args.output)
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
# TODO: refactor this long assignment
|
# TODO: refactor this long assignment
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue