Changes

Jump to: navigation, search

Gramps 4.1 Wiki Manual - Command Line

1,118 bytes added, 22:02, 5 February 2016
m
Protected "Gramps 4.1 Wiki Manual - Command Line": outdated user manual ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
The '''python options''' that you may come across are:
* <code>-E </code> Ignore all PYTHON* environment variables, e.g. <code>PYTHONPATH </code> and <code>PYTHONHOME</code>, that might be set.* <code>-O </code> Turn on basic optimizations. This changes the filename extension for compiled (bytecode) files from <code>.pyc </code> to <code>.pyo</code>. See also PYTHONOPTIMIZE.
The <code>-O </code> optimise flag has a number of effects in Gramps:
* If it is not turned on, an additional '''Debug''' entry appears in the '''Tools''' menu.
* If it is not turned on, [[Logging_system#So_how_logging_works_in_Gramps_after_all.3F|info logging messages are output]].
python gramps.py JohnDoe.ged
The first opens a family tree, the second imports a gedcom GEDCOM into an empty family tree.
Additionally, you can pass Gramps the name of the family tree to be opened:
* use this option : <precode>-O famtree</precode> or <precode>--open=famtree </precode>
<code>-O</code>, Open of a family tree. This can be done also by just typing the name (name or database dir)
Examples:
{{Man tip| Tip |If no option is given, just a name, Gramps will ignore the rest of the command line arguments. Use the <code>-O </code> flag to open, <code>-i </code> to import, and do something with the data.}}
{{Man tip| Tip |Only family trees can be opened directly. For other formats, you will need to use the import option which will set up the empty database and then import data into it.}}
gramps -O "Family Tree 1" -a report -p "name=family_group,style=default,off=html,of=test.html,css="
{{man tip| Report option string |The report option string should satisfy the following conditions: <br />It must not contain any spaces (due to the general nature of the command line interface). If some arguments need to include spaces, the string should be enclosed with quotation marks.<br />Option string must list pairs of option names and values.Within a pair, option name and value must be separated by the equal sign.<br />Different pairs must be separated by commas.}}
Most of the report options are specific for every report. However, there are some common options.
*<code>name=report_name</code>: This mandatory option determines which report will be generated.
{{man note|Report names|If the supplied report_name does not correspond to any available report, an error message will be printed followed by this list of available reports.<br />
<pre>
WebCal - Web Calendar
</pre>}}
*<code>of </code>: output filename*<code>off</code>: output format. These are the extension an output format makes available, eg, pdf, html, doc, ...*<code>style</code>: for text reports, the stylesheet to use. Defaults to 'default'.*<code>show=all</code>: This will produce the list of names for all options available for a given report.*<code>show=option_name</code>: This will print the description of the functionality supplied by the option_name, as well as what are the acceptable types and values for this option.
So, to learn to use a report, do for example:
=== Force unlock option ===
*<code>-u, </code>: you can extend the <code>-O </code> flag with <code>-u </code> to force a locked family to be unlocked. This allows you to recover from a crash that leaves the family tree (database) locked, from the command line.
An example (to unlock the "Family Tree 1" database):
:<code>gramps -O "Family Tree 1" -a report -u > /dev/null</code>
{{man note|Note that it |It is not possible to open family trees that need repair from the command line.}}
=== Configuration (config) option ===
The option takes three forms:(the following examples, except 3.2, use behavior.database-path as the When all configuration variable to change(s) are set Gramps will start with these new values.)
These options can takes three forms:{{man note|Note|Except for examples <tt>1) See all config values</tt> and <tt>3.2</tt>, All the following examples, use <code>behavior.database-path</code> as the configuration variable to change.}}
1) See all config values: <code>-s </code> or <code>--show</code><br>For example:<pre>$python gramps.py -showGramps config settings from /home/username/.gramps/gramps41/gramps.ini:behavior.max-age-prob-alive=110behavior.betawarn=falsebehavior.check-for-updates=0behavior.check-for-update-types=['new']behavior.avg-generation-gap=20behavior.database-path='/home/grampsdev/.gramps/grampsdb'behavior.startup=0behavior.database-backend='bsddb'</pre>
[[Image:CommandLineExampleOutput-s-40.png|400px|thumb|right|Fig. {{#var:chapter}}.{{#vardefineecho:figure|{{#expr:{{#var:figure}}+1}}}} Command Line Example Output for ''python gramps.py -s'']]
{{-}}
2) See a value:<code>--config=behavior.database-path</code> or <code>-c behavior.database-path</code><br>For example:<pre>$python gramps.py --config=behavior.database-pathCurrent Gramps config setting: behavior.database-path:'/home/username/.gramps/grampsdb'</pre>
3) Set a value: <code>--config=behavior.database-path :'/media/mydb'</code> or <code>-c behavior.database-path:'/media/mydb'</code><br>For example:
3.1) Set a valueto its default: <code>--config=behavior.database-path:DEFAULT</code> or <code>-c behavior.database-path:DEFAULT</code><br>For example:
--config=behavior.database-path:'/media/mydb' or -c behavior.database-path:'/media/mydb' 3.1) Set a value to its default:  --config=behavior.database-path:DEFAULT or -c behavior.database-path:DEFAULT 3.2) Set more than one value:  <code>--config=behavior.use-tips:False --config=behavior.autoload:True </code> or <code>-c behavior.use-tips:False -c behavior.autoload:True</code> When all configuration variable(s) are set Gramps will start with these new values.<br>For example:
== Operation ==
*To import four databases (whose formats can be determined from their names) and then check the resulting database for errors, one may type:
:<precode>gramps -i file1.ged -i file2.gpkg -i ~/db3.gramps -i file4.wft -a check</precode>
*To explicitly specify the formats in the above example, append filenames with appropriate -f options:
:<precode>gramps -i file1.ged -f gedcom -i file2.gpkg -f gramps-pkg -i ~/db3.gramps -f gramps-xml -i file4.wft -f wft -a check</precode>
*To record the database resulting from all imports, supply -e flag (use -f if the filename does not allow Gramps to guess the format):
:<precode>gramps -i file1.ged -i file2.gpkg -e ~/new-package -f gramps-pkg</precode>
*To save any error messages of the above example into files outfile and errfile, run:
:<precode>gramps -i file1.ged -i file2.dpkg -e ~/new-package -f gramps-pkg >outfile 2>errfile </precode>
*To import three databases and start interactive Gramps session with the result:
:<precode>gramps -i file1.ged -i file2.gpkg -i ~/db3.gramps </precode>
*To open a database and, based on that data, generate timeline report in PDF format putting the output into the my_timeline.pdf file:
:<precode>gramps -O 'Family Tree 1' -a report -p name=timeline,off=pdf,of=my_timeline.pdf </precode>
{{man tip|1=Listing report options |2=Use the <ttcode>''name=timeline,show=all''</ttcode> to find out about all available options for the timeline report. To find out details of a particular option, use <ttcode>''show=option_name''</ttcode> , e.g. <ttcode>''name=timeline,show=off''</ttcode> string. To learn about available report names, use <ttcode>''name=show''</ttcode> string.}}
*To convert the bsddb database on the fly to a .gramps xml file:
:<precode>gramps -O 'Family Tree 1' -e output.gramps -f gramps-xml</precode>
* To generate a web site into an other locale (in german):
:<precode>LANGUAGE=de_DE; LANG=de_DE.UTF-8 gramps -O 'Family Tree 1' -a report -p name=navwebpage,target=/../de </precode>
*Finally, to start normal interactive session type:
:<precode>gramps</precode>
== Environment variables==

Navigation menu