View Single Post
Old 01-14-2016, 10:23 AM   #58
DaltonST
Deviser
DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.
 
DaltonST's Avatar
 
Posts: 2,265
Karma: 2090983
Join Date: Aug 2013
Location: Texas
Device: none
Quote:
Originally Posted by alutian View Post
OK. RAMDrive A: back online.

Windows Temp -> A:\TEMP, CALIBRE_TEMP_DIR -> C:\TEMP

Fires up Calibre and it works... but no Library Codes

Windows Temp -> A:\TEMP, CALIBRE_TEMP_DIR -> A:\TEMP

Fires up Calibre and it works... but no Library Codes

Windows Temp -> C:\TEMP, CALIBRE_TEMP_DIR -> A:\TEMP

Fires up Calibre and it works - and so does Library Codes!!

I canna be bothered with the last combination - we all know both on the C: drive works.

So, back to my earlier idea...

Something in Library Codes writes to the Windows Temp directory, then reads from C:\Temp. Fine if the Temp directory is C:\Temp, but not if Windows Temp -> A:\Temp.

Alutian
@Alutian:

Did you update your Environment Variables that Python uses to force temporary files to go where you want them to go? Especially TMPDIR, since that is the first place it tries before moving down its list of places to check.

Also, since you use Windows, and per the Python documentation, it would be a good idea for you to physically delete c:\temp and c:\tmp. That would force it into '\temp' and '\tmp'.

Quote:
The default directory is chosen from a platform-dependent list, but the user of the application can control the directory location by setting the TMPDIR, TEMP or TMP environment variables

Python searches a standard list of directories to find one which the calling user can create files in. The list is:

  • The directory named by the TMPDIR environment variable.
  • The directory named by the TEMP environment variable.
  • The directory named by the TMP environment variable.
  • A platform-specific location:
    On Windows, the directories C:\TEMP, C:\TMP, \TEMP, and \TMP, in that order.
  • On all other platforms, the directories /tmp, /var/tmp, and /usr/tmp, in that order.
  • As a last resort, the current working directory.
CALIBRE_TEMP_DIR only is used by plugins that use only Calibre APIs and native Calibre Methods.

Some people naively think that all plug-ins can be lumped together as "a plug-in", and the same rules apply to all of them. Not so.

My Library Codes, QuarantineAndScrub, Multi-Column Search, English Noun Frequenies, CALM, Author Book Count, and Author Book Count Hierarchy add-ons and plug-ins do not fall into that category. At all. To the extent they use Calibre APIs and native Calibre Methods, of course they automatically use CALIBRE_TEMP_DIR. Otherwise, generic Python rules are in play. Hence, TMPDIR etc. as documented above (and soon to be in the Original Posts of all of my plug-ins that create temporary files other than through native Calibre Methods).



DaltonST

Last edited by DaltonST; 01-14-2016 at 10:44 AM.
DaltonST is offline   Reply With Quote