Skip to content

Error: pelican-import --wpfile interprets "/" on post titles as a filename/basename #3561

@A-Infor

Description

@A-Infor
  • I have read the Filing Issues and subsequent “How to Get Help” sections of the documentation.
  • I can reproduce this problem with stock/default settings file, theme, and sample content (as described in above “How to Get Help” sections of the documentation).
  • I have searched the issues (including closed ones) and believe that this is not a duplicate.
  • OS version and name: Debian 12
  • Python version: 3.11.2
  • Pelican version: 4.11.0.post0
  • Link to theme: no theme set
  • Links to plugins: no plugins installed
  • Link to your site: still not published
  • Link to your source: no source repository, just a local directory
  • Link to a Gist with the contents of your settings file: https://gist.github.com/A-Infor/9c03b7f78dc32eac0f12868857c22c29

Issue

$ pelican-import --wpfile Posts.wordpress.xml 
content/🎞️-Alemanha-Socialista-∋-🕵️-Stasi-(Polícia-Secreta).rst
content/O-Perigo-da-Assexualidade.rst
content/Algumas-questões-que-afligem-os∕as-assexuais.rst
content/Sectarismo→hostilidade-∧-ideologias.rst
content/'Você-=-privilegiado!'.rst
content/Diversidade-sexual-≠-militância-pró-sexo.rst
content/Amor-e-sexo--diferenças-qualitativas.rst
content/Assexualidade-🆚-expectativas-alheias.rst
content/-Esquecer-&-Perdoar--≠--Vigiar-&-Punir-.rst
content/Assexualidade-∧-liberdade-de-não-buscar-parceiro(a)s.rst
content/Assexualidade--FAQ.rst
content/O-👑-poder-corrompe-∕-Lutzenberger.rst
content/⛪️-Violência-∈-Mal-→¬Mal-∌-Violência-∕-Tolstói.rst
content/🇧🇬-Bulgária--o-país-mais-corrupto-da-🇪🇺-União-Europeia.rst
content/Por-fora,-bela-viola-∧-por-dentro,-pão-bolorento.rst
content/🏴📚-Editora-Monstro-dos-Mares--conheça!.rst
Traceback (most recent call last):
  File "/home/analista/virtualenvs/pelican/bin/pelican-import", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/analista/virtualenvs/pelican/lib/python3.11/site-packages/pelican/tools/pelican_import.py", line 1259, in main
    fields2pelican(
  File "/home/analista/virtualenvs/pelican/lib/python3.11/site-packages/pelican/tools/pelican_import.py", line 973, in fields2pelican
    assert slug is None or filename == os.path.basename(
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: filename is not a basename: Marxistas profissionais / 🏺 Platão

The post with title "Marxistas profissionais / 🏺 Platão" can't be imported due to the "/" on the title.
The other posts successfully imported before this one had the common slash "/" manually replaced by me for a division slash "∕", that does the trick of fooling Pelican.
But I have far too many posts with slashes on the title to keep doing that!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions