Author eosborne
Recipients eosborne
Date 2021-01-27.13:06:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
When I create a temporary directory, the name doesn't come back in a way the application expects it.  I ran into this using gitPython and I'm not entirely clear whether it's a tmpfile issue or a gitpython issue, but I think it's tempfile.  


In [12]: td = tempfile.TemporaryDirectory()

In [13]:
Out[13]: '/var/folders/kd/bjhw84ss2x734frx98qh1mw40000gn/T/tmpgralfh9m'

In [14]: str(td)
Out[14]: "<TemporaryDirectory '/var/folders/kd/bjhw84ss2x734frx98qh1mw40000gn/T/tmpgralfh9m'>"

The problem with this is that gitPython takes a temporary directory as an argument and effectively does a mkdir(str(td)), which creates a weird directory in /var/tmp:

eosborne@eosborne-salt-master:/tmp$ ls -alhd *Temp*
drwxrwxr-x 3 eosborne eosborne 4.0K Jan 27 12:42 '<TemporaryDirectory '\'''

I believe that str(td) should return just the directory name and that repr(td) can return the extra bit of text with "<TemporaryDirectory ..>" but that's just my two cents.

I have thrown this issue up on the gitPython list too:
Date User Action Args
2021-01-27 13:06:25eosbornesetrecipients: + eosborne
2021-01-27 13:06:25eosbornesetmessageid: <>
2021-01-27 13:06:25eosbornelinkissue43039 messages
2021-01-27 13:06:25eosbornecreate