diff --git a/test/test_xacro.py b/test/test_xacro.py
index 0fb58a4..fbb14d6 100644
--- a/test/test_xacro.py
+++ b/test/test_xacro.py
@@ -36,6 +36,7 @@
import itertools
import math
import os.path
+import pathlib
import re
import shutil
import subprocess
@@ -1702,6 +1703,15 @@ def test_remove_property(self):
${p}'''
self.assert_matches(self.quick_xacro(src), '2nd')
+ def test_process_file_types(self):
+ # Test that checks process_file method with different path types
+ # os.path
+ path = os.path.join(os.path.dirname(__file__), 'emoji.xacro')
+ self.assert_matches(xacro.process(path), '🍔')
+
+ # pathlib.Path
+ path = pathlib.Path(os.path.join(os.path.dirname(__file__), 'emoji.xacro'))
+ self.assert_matches(xacro.process(path), '🍔')
if __name__ == '__main__':
unittest.main()
diff --git a/xacro/__init__.py b/xacro/__init__.py
index 09141df..ef224df 100644
--- a/xacro/__init__.py
+++ b/xacro/__init__.py
@@ -1115,7 +1115,7 @@ def process_file(input_file_name, **kwargs):
banner = [xml.dom.minidom.Comment(c) for c in
[" %s " % ('=' * 83),
# replace consecutive dashes with a single one to yield a XML-compliant comment string
- " | This document was autogenerated by xacro from %-30s | " % re.sub(r'-+', '-', input_file_name),
+ " | This document was autogenerated by xacro from %-30s | " % re.sub(r'-+', '-', str(input_file_name)),
" | EDITING THIS FILE BY HAND IS NOT RECOMMENDED %-30s | " % "",
" %s " % ('=' * 83)]]
first = doc.firstChild