\input{} File does not exist [duplicate]

I have written a template for a personal diary. The main tex file \input a file called entries.tex, which will \input all the diary entries, which are in a subdirectory, as well as write the title of the entry and the date it is in (both of which it gets from the path and filename)

entries.tex is generated by a python script called entries.py, the output of this script looks like this:

\textbf{This is the title}  \hspace*{\fill}  \textbf{2018-11-16}\\
\input{entries/2018/11/16 - This is the title} \bigskip

\textbf{This is another entry}  \hspace*{\fill}  \textbf{2018-11-18}\\
\input{entries/2018/11/18 - This is another entry} \bigskip


And the main.tex file looks like this:

\documentclass{article}
\usepackage[margin=4cm,left=2cm,right=2cm]{geometry}

\title{\huge{}Personal Diary}
\author{\LARGE{}Author name}
\date{Last written \today}

\begin{document}

\maketitle
\newpage

\input{entries}

\end{document}


The directory tree looks like this:

Diary
├── entries
│   └── 2018
│       ├── 01
│       ├── 02
│       ├── 03
│       ├── 04
│       ├── 05
│       ├── 06
│       ├── 07
│       ├── 08
│       ├── 09
│       ├── 10
│       ├── 11
│       │   ├── 16 - This is the title.tex
│       │   └── 18 - This is another entry.tex
│       └── 12
├── entries.py
├── entries.tex
├── main.tex
└── makefile


However, when I try to compile main.tex, it seems to find entries.tex, but not the files that entries.tex includes. The output of it looks like this:

python3 entries.py
pdflatex main.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2019/dev/Debian)  (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./main.tex
LaTeX2e <2018-04-01> patch level 5
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifvtex.sty)
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty))
No file main.aux.
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./entries.tex

! LaTeX Error: File entries/2018/11/16 - This is the title.tex' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: tex)

Enter file name:


I'm sure that entries/2018/11/16 - This is the title.tex exists. Does anyone have any idea why LaTeX wouldn't be finding it?

I have made a github repo with all the code on for anyone who wants to try it out: https://github.com/ventlion/latexdiary

marked as duplicate by Werner, Mensch, Troy, user121799, Stefan PinnowNov 19 '18 at 5:28

• you ask about \include but your example code does not use that command, it uses \input, but either way it is far simpler if you do not use spaces in file names. – David Carlisle Nov 18 '18 at 19:26
• Whoops, my bad. I'll change that now. – Syne Nov 18 '18 at 19:28
• if you really must use spaces then \input{"entries/2018/11/18 - This is another entry"} with double quotes but I would not use spaces. – David Carlisle Nov 18 '18 at 19:30
• I have just tried it now, with underscores instead of spaces, and that has fixed the issue. Out of curiosity, what is wrong with using spaces and double quotes when using \input{}? – Syne Nov 18 '18 at 19:31
• at the primitive tex syntax level the file input syntax is \input fooo  with the filename terminated by a space.... but away from tex spaces in filenames are a pain, in a bash shell try ls 16 - This is the title.tex to see if it lists the filename... – David Carlisle Nov 18 '18 at 19:33

\input{"entries/2018/11/18 - This is another entry"}
`