Skip to content

Commit a393a81

Browse files
v3.8
1 parent 3eb922d commit a393a81

File tree

12 files changed

+54
-21
lines changed

12 files changed

+54
-21
lines changed

packages/markitdown/setup.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = openize-markitdown
3-
version = 25.3.7
3+
version = 25.3.8
44
author = Openize
55
author_email = packages@openize.com
66
description = A document converter for Word, PDF, Excel, and PowerPoint to Markdown.
@@ -41,7 +41,7 @@ console_scripts =
4141
post-install = openize.markitdown.post_install:ask_license
4242

4343
[aspose-licenses]
44-
use_aspose_license = true
45-
license_file_path = /path/to/Aspose.Total.lic
44+
use_aspose_license = false
45+
license_file_path = D:/aspose lic/2020/Conholdate.Total.NET.lic
4646

4747

packages/markitdown/setup.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
from setuptools import setup
3+
from setuptools.command.install import install
4+
import subprocess
5+
6+
class PostInstallCommand(install):
7+
"""Post-installation for installation mode."""
8+
def run(self):
9+
install.run(self) # Run the standard install first
10+
subprocess.call(["python", "post_install.py"]) # Run post-install script
11+
12+
setup(
13+
setup_requires=['setuptools'],
14+
cmdclass={'install': PostInstallCommand},
15+
)

packages/markitdown/src/openize/markitdown/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
(.docx, .pdf, .xlsx, .pptx) to Markdown format.
77
"""
88

9-
__version__ = "25.3.7"
9+
__version__ = "25.3.8"
1010

11-
from .processor import DocumentProcessor
12-
from .converters import WordConverter, PDFConverter, ExcelConverter, PowerPointConverter
13-
from .factory import ConverterFactory
14-
from .llm_strategy import SaveLocally, InsertIntoLLM
15-
from .license_manager import LicenseManager
11+
from processor import DocumentProcessor
12+
from converters import WordConverter, PDFConverter, ExcelConverter, PowerPointConverter
13+
from factory import ConverterFactory
14+
from llm_strategy import SaveLocally, InsertIntoLLM
15+
from license_manager import LicenseManager
1616

1717
__all__ = [
1818
'DocumentProcessor',
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,35 @@
11
import configparser
22

3+
import configparser
4+
import os
5+
6+
37
def get_config():
4-
"""Reads settings from setup.cfg"""
8+
"""Reads settings from setup.cfg if available."""
59
config = configparser.ConfigParser()
6-
config.read("../../setup.cfg")
7-
return config
10+
11+
# Possible locations for setup.cfg
12+
possible_paths = [
13+
os.path.join(os.getcwd(), "setup.cfg"), # Current working directory
14+
os.path.abspath(os.path.join(__file__, "../../../../setup.cfg")), # Relative to script location
15+
]
16+
17+
for path in possible_paths:
18+
if os.path.exists(path):
19+
print(f"✅ Found setup.cfg at: {path}")
20+
config.read(path)
21+
return config
22+
23+
print("❌ setup.cfg not found. Using default settings.")
24+
return config # Returns an empty config
25+
826

927
def get_license_path():
1028
"""Fetches Aspose license path from setup.cfg or uses a default."""
1129
config = get_config()
12-
return config.get("aspose", "license_path", fallback="Aspose.Total.lic")
30+
return config.get("aspose-licenses", "license_file_path", fallback="Aspose.Total.lic")
1331

1432
def use_aspose_license():
1533
"""Checks if Aspose license should be applied (True/False)."""
1634
config = get_config()
17-
return config.getboolean("aspose", "use_aspose_license", fallback=True) # Defaults to True
35+
return config.getboolean("aspose-licenses", "use_aspose_license", fallback=True) # Defaults to True

packages/markitdown/src/openize/markitdown/converters.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,27 @@ def clean_text(text):
2525
class WordConverter(DocumentConverter):
2626
def convert_to_md(self, input_path, output_dir):
2727
try:
28-
doc = aw.Document(input_path.resolve())
28+
doc = aw.Document(str(input_path.resolve()))
2929
output_file = output_dir / f"{input_path.stem}.md"
3030
doc.save(str(output_file), aw.SaveFormat.MARKDOWN)
3131
return output_file
3232
except FileNotFoundError:
3333
logging.error(f"File not found: {input_path}")
34-
except aw.FileFormatException:
34+
except aw.FileCorruptedException:
3535
logging.error(f"Invalid Word file format: {input_path}")
3636
except Exception as e:
3737
logging.error(f"Error converting {input_path}: {e}")
3838

3939
class PDFConverter(DocumentConverter):
4040
def convert_to_md(self, input_path, output_dir):
4141
try:
42-
doc = aw.Document(input_path.resolve())
42+
doc = aw.Document(str(input_path.resolve()))
4343
output_file = output_dir / f"{input_path.stem}.md"
4444
doc.save(str(output_file), aw.SaveFormat.MARKDOWN)
4545
return output_file
4646
except FileNotFoundError:
4747
logging.error(f"File not found: {input_path}")
48-
except aw.FileFormatException:
48+
except aw.FileCorruptedException:
4949
logging.error(f"Invalid PDF file format: {input_path}")
5050
except Exception as e:
5151
logging.error(f"Error converting {input_path}: {e}")

0 commit comments

Comments
 (0)