Skip to content

Commit

Permalink
Replace module imghdr with puremagic as it becomes obsolete with Pyth…
Browse files Browse the repository at this point in the history
…on 3.13
  • Loading branch information
DivingDuck committed Oct 12, 2024
1 parent d4080ef commit 3dd7c5e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
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'

0 comments on commit 3dd7c5e

Please sign in to comment.