Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace module imghdr with puremagic #1455

Merged
merged 1 commit into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions printrun/projectlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import time
import zipfile
import tempfile
import imghdr
import puremagic
import copy
import re
from collections import OrderedDict
Expand Down Expand Up @@ -756,7 +756,7 @@ def parse_3DLP_zip(self, name):

for f in imagefilesOrderedDict.values():
path = os.path.join(self.image_dir.name, f)
if os.path.isfile(path) and imghdr.what(path) in accepted_image_types:
if os.path.isfile(path) and puremagic.what(path) in accepted_image_types:
ol.append(path)

return ol, -1, 'Bitmap'
Expand All @@ -780,7 +780,7 @@ def parse_sl1(self, name):
ol = []
for f in sorted(os.listdir(self.image_dir.name)):
path = os.path.join(self.image_dir.name, f)
if os.path.isfile(path) and imghdr.what(path) in accepted_image_types:
if os.path.isfile(path) and puremagic.what(path) in accepted_image_types:
ol.append(path)

return ol, -1, 'PrusaSlicer', settings
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pyglet >= 1.1, < 2.0
psutil (>= 2.1)
lxml (>= 2.9.1)
platformdirs
puremagic
dbus-python >= 1.2.0 ; sys_platform == 'linux'
pyobjc-framework-Cocoa ; sys_platform == 'darwin'
pyreadline3 ; sys_platform == 'win32'
Loading