Prev
Next
Index->
contents
reference
index
search
external
Up->
dismod_at
python
connection_file
user_connection_file.py
user_connection_file.py
@(@\newcommand{\B}[1]{ {\bf #1} }
\newcommand{\R}[1]{ {\rm #1} }
\newcommand{\W}[1]{ \; #1 \; }@)@
This is dismod_at-20221105 documentation: Here is a link to its
current documentation
.
Example Using connection_file
Source Code
Source Code
import sys
import os
#
test_program = 'example/user/connection_file.py'
if sys. argv[ 0 ] != test_program or len ( sys. argv) != 1 :
usage = 'python3 ' + test_program + '\n'
usage += 'where python3 is the python 3 program on your system\n'
usage += 'and working directory is the dismod_at distribution directory\n'
sys. exit ( usage)
#
# import dismod_at
local_dir = os. getcwd () + '/python'
if ( os. path. isdir ( local_dir + '/dismod_at' ) ) :
sys. path. insert ( 0 , local_dir)
import dismod_at
#
# change into the build/example/user directory
if not os. path. exists ( 'build/example/user' ) :
os. makedirs ( 'build/example/user' )
os. chdir ( 'build/example/user' )
#
# connection
new = True
database = 'example.db'
connection = dismod_at. create_connection ( database , new)
#
# file_name
file_name = dismod_at. connection_file ( connection)
#
# check
assert os. path. samefile ( file_name, database)
#
print ( 'connection_file.py: OK' )
sys. exit ( 0 )
Input File: example/user/connection_file.py