Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99021630
bibtex2bip.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jan 18, 13:06
Size
785 B
Mime Type
text/x-python
Expires
Mon, Jan 20, 13:06 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23688504
Attached To
R3596 pybliographer
bibtex2bip.py
View Options
"""
Parse a BibTeX file into a BIP (a native pybliographer database) file.
Usage: bibtex2bip.py <BibTeX file> <BIP file>
"""
import
sys
,
os
in_f
,
out_f
=
sys
.
argv
[
1
:
3
]
from
Pyblio.Parsers.Semantic
import
BibTeX
from
Pyblio
import
Store
,
Registry
Registry
.
load_default_settings
()
# This id refers to the bibtex format as known by pybliographer by
# default.
sid
=
"org.pybliographer/bibtex/0.1"
# Get the schema associated with the specified id
schema
=
Registry
.
getSchema
(
sid
)
# Create a new db using this schema. We need to ensure the file does
# not exist yet.
try
:
os
.
unlink
(
out_f
)
except
OSError
:
pass
db
=
Store
.
get
(
'file'
)
.
dbcreate
(
out_f
,
schema
)
# Import the content of the bibtex file into it
fd
=
open
(
in_f
)
reader
=
BibTeX
.
Reader
()
reader
.
parse
(
fd
,
db
)
db
.
save
()
Event Timeline
Log In to Comment