On Fri, Jul 26, 2019 at 5:52 AM Kirill Balunov <kirillbalu...@gmail.com> wrote: > > > > чт, 25 июл. 2019 г. в 19:16, Chris Angelico <ros...@gmail.com>: >> >> On Fri, Jul 26, 2019 at 1:30 AM Kirill Balunov <kirillbalu...@gmail.com> >> wrote: >> > >> > Hi all! It is expected that: >> > ``` >> > >>> import os >> > >>> from pathlib import Path >> > >>> dummy = " " # or "" or " " >> > >>> os.path.isdir(dummy) >> > False >> > >>> Path(dummy).is_dir() >> > True >> > ``` >> > >> > or was it overlooked? >> > >> [....] >> I'm not sure if this is considered an important enough bug to actually fix, >> or >> if it's merely a curiosity that occurs when you trigger undocumented >> behaviour. >> > > No, it's not just because of curiosity. I will try to tell the background, > and maybe I went the wrong way initially. There is a very cool project > https://github.com/3b1b/manim, it allows you to visualize math (I don’t know > how to describe it better you can see some examples here > https://www.3blue1brown.com) and it works lovely on Linux. For some reason, I > need to use it on Windows. Problems began to arise when I tried my scripts > were some latex was included in the animation. >
Ah, I love 3b1b! Great videos. I toyed with manim once (wanting to create new Fourier visualizations), but the open source parts weren't enough for what I was trying to do. Very cool though. > So I installed TexLive, but it didn't produce any output :) In `manim` it is > invoked through a system call > https://github.com/3b1b/manim/blob/master/manimlib/utils/tex_file_writing.py#L40 > like this: > > $ latex -interaction=batchmode -halt-on-error -output-directory=... input.tex > > /dev/null > > For some reason TexLive does not understand Windows relative paths of this > form -output-directory =".\Output" and ".\Input\file.tex", but it > understands the absolute paths in Windows form like > "C:\path\to\the\input\file.tex". I read that Windows allows also to provide > paths in the usual form "./Input/file.tex" (maybe I'm wrong with my > understanding what does it mean on Windows), > It means the same thing as your other relative path. The two types of slash should basically be interchangeable. > I've tested and this worked. But the problem is that Python always inserts > '\' as path separators on Windows and there is no control to set it up. I > decided to rewrite all this stuff with the help of `pathlib` module and to > use `Path` and `.as_posix` method everywhere. Paths are set here > https://github.com/3b1b/manim/blob/c7e6d9d4742ec47098bd86a9bbb4212cc637206b/manimlib/constants.py#L10 > and the author uses `MEDIA_DIR = ""` as a default unset value, and then > checks `if not os.path.isdir(MEDIA_DIR)`. The documentation states that > `os.path.isdir(...)` is equivalent to `Path(...).is_dir()` but it is not > true. So I wrote here. > Gotcha. It'd probably be safe to change it to "." instead; that way, it's an actual valid directory name and can be combined normally with other components. ChrisA -- https://mail.python.org/mailman/listinfo/python-list