Skip to content

Commit 537eaf6

Browse files
committed
Small update
1 parent fe7fa80 commit 537eaf6

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

pyneofile/pyneofile.py

Lines changed: 11 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:
@@ -112,10 +116,13 @@
112116
shared_memory = None
113117

114118
def running_interactively():
119+
import sys
115120
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
121+
return (
122+
hasattr(sys, "ps1") or
123+
bool(getattr(sys.flags, "interactive", 0)) or
124+
(main is not None and not hasattr(main, "__file__"))
125+
)
119126

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

0 commit comments

Comments
 (0)