01-21-2009, 02:52 PM | #16 |
hopeless n00b
Posts: 5,111
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
Help, the CALIBRE_CONFIG_DIRECTORY doesn't seem like it's doing anything. First I tried the batch file above, didn't work. Then I switched %cd% for an absolute path, didn't work either. Last, I added it via My Computer >> Properties >> Advanced >> Environment Variables and still didn't work.
I tried it on two computers (XP Pro SP2, Vista Ultimate SP1) and one virtual machine (XP Pro SP3) using Calibre 0.4.128 (what I have installed) and Calibre 0.4.127 (version where the CALIBRE_CONFIG_DIRECTORY was introduced based on the changelog). Thanks! |
01-21-2009, 03:11 PM | #17 |
creator of calibre
Posts: 43,835
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You can check what config directory calibre is using with
Code:
calibre-debug -c "from calibre.utils.config import config_dir; print config_dir" |
Advert | |
|
01-21-2009, 04:50 PM | #18 |
hopeless n00b
Posts: 5,111
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
That's just it. No matter what I try, Calibre still uses %appdata% and ignores the value of the CALIBRE_CONFIG_DIRECTORY environment variable. It doesn't matter if %appdata%\calibre already exists or not. Calibre still uses it.
|
01-21-2009, 04:57 PM | #19 |
creator of calibre
Posts: 43,835
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Its not picking up the environment variable in that case. What does the following print out
Code:
calibre-debug -c "import os; print os.environ['CALIBRE_CONFIG_DIRECTORY']" |
01-21-2009, 05:15 PM | #20 |
hopeless n00b
Posts: 5,111
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
Code:
Traceback (most recent call last):
File "debug.py", line 105, in <module>
File "debug.py", line 89, in main
File "<string>", line 1, in <module>
File "os.pyo", line 423, in __getitem__
KeyError: 'CALIBRE_CONFIG_DIRECTORY'
Additional info: This was using Calibre 0.4.128. |
Advert | |
|
01-21-2009, 05:26 PM | #21 |
creator of calibre
Posts: 43,835
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
That means the variable is not present in the process environment. Try rebooting.
|
01-21-2009, 05:42 PM | #22 |
hopeless n00b
Posts: 5,111
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
Thanks for the help with troubleshooting. Unfortunately, having to reboot the PC kinda defeats the whole "portable" thing.
Is it possible to include parsing of a config.ini/calibre.ini file inside the calibre install directory? The .ini file could then contain the path of the config files and (and maybe even the path of the library/database) relative to the calibre directory. Thanks! |
01-21-2009, 05:48 PM | #23 |
creator of calibre
Posts: 43,835
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You only need to reboot if you're adding the environment variable via the control panel. You probably just have to modify your bat file to get it to correctly set the environment variable. Again some one familiar with bat files will have to help you with that
|
01-21-2009, 07:51 PM | #24 |
hopeless n00b
Posts: 5,111
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
Thanks for the tip. Finally figured out my mistake.
I was using: Code:
set CALIBRE_CONFIG_DIRECTORY = %CD%
Code:
set CALIBRE_CONFIG_DIRECTORY=%CD%
Tested the fixed batch file on three systems (two PCs w/o Calibre and one VM with Calibre already installed). It seems to work quite well. It didn't overwrite the config files in the native installation of Calibre which is a good thing. Oh well, I'm just happy it doesn't leave any traces in the host computer. portablecalibre.bat Code:
@echo off
cd config
set CALIBRE_CONFIG_DIRECTORY=%cd%
cd..
cd calibre
calibre.exe --with-library ..\calibre-db
exit
|
01-22-2009, 02:51 AM | #25 |
Member
Posts: 10
Karma: 10
Join Date: Jan 2009
Device: Sony PRS-T1, Kindle4NT
|
would be in short:
portablecalibre.bat Code:
@echo off
set CALIBRE_CONFIG_DIRECTORY=%cd%config
cd calibre
calibre.exe --with-library ..\calibre-db
exit
Friedhelm. |
02-09-2009, 12:34 AM | #26 |
Junior Member
Posts: 6
Karma: 10
Join Date: Feb 2009
Device: iPod Touch/Kindle on order
|
So, what directory structure would I use on my USB key for this .bat file to work? And where do you put the .bat file? In the program directory?
|
02-09-2009, 04:17 AM | #27 |
Wizard
Posts: 4,552
Karma: 950151
Join Date: Nov 2008
Device: Sony PRS-950, iphone/ipad (Marvin/iBooks/QuickReader)
|
You are obviously not experienced at reading batch files
The bat file assumes that relative to where it is located on the USB disk you have the following sub-folders: config calibre calibre-db The config folder is where calibre is going to store its private config information; the calibre folder has a copy of the calibre binaries (in effect a copy of what is normally installed to C:\Program Files\calibre); and the calibre-db folder is where the calibre database is located. If you want a different folder structure you can modify the .bat file accordingly. You would normally navigate to the .bat file on the USB stick using Windows Explorer, and then double-click/open the batch file to run it. |
05-18-2011, 04:39 AM | #28 |
Junior Member
Posts: 1
Karma: 10
Join Date: May 2011
Device: Nook
|
Example.
Hi, can you provide a full example of a valid batch?
Thanks. |
05-18-2011, 04:43 AM | #29 |
Wizard
Posts: 4,552
Karma: 950151
Join Date: Nov 2008
Device: Sony PRS-950, iphone/ipad (Marvin/iBooks/QuickReader)
|
Not sure what you mean?
The calibre-portable.bat file that is supplied in the resources sub-folder of the calibre install IS a valid batch file. If you use the folder structure mentioned in at the top in the comments then it will work unmodified. If you want to use alternative locations for any of the files then you need to edit in the paths you want to use instead. |
Tags |
calibre, portable |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
different database for different categories | reup | Calibre | 3 | 06-20-2010 11:25 AM |
Readonly Database | seanbw | Calibre | 6 | 03-17-2010 06:30 PM |
What Database? | LadyLou | Calibre | 8 | 02-12-2010 06:32 AM |
Database outage | Alexander Turcic | Announcements | 2 | 07-14-2005 04:44 PM |
Database troubles | Alexander Turcic | Announcements | 2 | 04-20-2005 01:02 PM |