Skip to content

Commit abb14f1

Browse files
committed
Small update
1 parent 9304fad commit abb14f1

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

pyfoxfile/pyfoxfile.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import base64
3131
import struct
3232
import logging
33-
import zipfile
3433
import platform
3534
import datetime
3635
import binascii
@@ -68,6 +67,11 @@
6867
BINARY_TYPES = (bytes, bytearray, memoryview)
6968
PATH_TYPES = (str, os.PathLike)
7069

70+
try:
71+
import zipfile_zstd as zipfile
72+
except (ImportError, OSError):
73+
import zipfile
74+
7175
# RAR file support
7276
rarfile_support = False
7377
try:
@@ -113,9 +117,11 @@
113117

114118
def running_interactively():
115119
main = sys.modules.get("__main__")
116-
no_main_file = not hasattr(main, "__file__")
117-
interactive_flag = bool(getattr(sys.flags, "interactive", 0))
118-
return no_main_file or interactive_flag
120+
return (
121+
hasattr(sys, "ps1") or
122+
bool(getattr(sys.flags, "interactive", 0)) or
123+
(main is not None and not hasattr(main, "__file__"))
124+
)
119125

120126
if running_interactively():
121127
logging.basicConfig(format="%(message)s", stream=PY_STDOUT_TEXT, level=logging.DEBUG)

0 commit comments

Comments
 (0)