Skip to content

Broken in Python3 #18

Description

@aidanharris

Thanks for this useful plugin.

It doesn't seem to work with Python3 since the urlparse module was renamed to urllib.parse (https://docs.python.org/2/library/urlparse.html#index-0).

Attached below is a simple patch that fixes the issue:

diff --git a/pelican_alias.py b/pelican_alias.py
index 92429bf..d4afa55 100644
--- a/pelican_alias.py
+++ b/pelican_alias.py
@@ -3,7 +3,12 @@ from __future__ import unicode_literals
 
 import os.path
 import logging
-from urlparse import urlparse
+from platform import python_version
+
+if float(python_version()[0:3]) < 3:
+    from urlparse import urlparse
+else:
+    from urllib.parse import urlparse
 
 from pelican import signals
 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions