![]() |
|
Help with pyGenealogical-Tools (Updated) - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Help with pyGenealogical-Tools (Updated) (/thread-21823.html) |
Help with pyGenealogical-Tools (Updated) - Matan_ran - Oct-16-2019 Hey everyone! I am a little bit of struggling with a project in Python here is the link for the software: https://pypi.org/project/pyGenealogicalTools/#description I have been installed all of the programs in the description, but I can't handle to properly "Run" the programme. This is my main programme as in the description - GeniTools.py: -------------- from pyGeni import profile
from pyGeni.geniapi_common import geni_calls
from parser_input import reader_input
from analyzefamily.ancerstors_climb import climb
from messages.genitools_messages import *
import logging
def main():
logging.basicConfig(filename='GeniToools.log', level=logging.INFO)
logging.info('Starting GeniTools\n' + "=" * 20 + "\n")
# Firstly the Input File is Read
data = reader_input.reader_input("INPUT")
base_call = geni_calls(data.genikey)
if (data.continue_execution and base_call.check_valid_genikey()):
# We only continue if inputs are correct!
test_profile = profile.profile(data.profile, data.genikey)
if (data.climbancestors or data.climbcousins):
climber = climb(test_profile)
if (data.climbcousins):
ancestors, matrix_count, included_profiles = climber.get_cousins(data.generations)
print(matrix_count)
if (data.climbancestors):
ancestors, affected_profiles = climber.get_ancestors(data.generations)
else:
logging.error(ERROR_MISSING_DATA)
logging.info('Finishing GeniTools' + "=" * 20 + "\n")
if __name__ == '__main__':
main()------------------------------Here is the reader_input file: import logging
from messages.parser_messages import *
class reader_input:
'''
General class parsing the data input
'''
def __init__(self, file_path):
self.file = open(file_path, "r")
self.profile = ""
self.genikey = ""
self.read_file()
self.file.close()
def read_file(self):
'''
Internal function reading the input file line by line
'''
self.continue_execution = True
self.profile_given = False
self.generations_given = False
self.genikey_given = False
self.climbancestors = False
self.climbcousins = False
for line in self.file:
divided = line.split()
if (divided[0] == "PROFILE"):
self.profile = str(divided[1])
self.profile_given = True
elif (divided[0] == "GENIKEY"):
self.genikey = str(divided[1])
self.genikey_given = True
elif (divided[0] == "CLIMB_ANCESTORS"):
self.climbancestors = True
elif (divided[0] == "CLIMB_COUSINS"):
self.climbcousins = True
elif (divided[0] == "GENERATIONS"):
self.generations = int(divided[1])
self.generations_given = True
if (not self.genikey_given):
logging.warning(GENI_KEY_MISSING)
self.continue_execution = False
if (self.climbancestors or self.climbcousins):
if (not self.profile_given):
logging.warning(PROFILE_MISSING)
self.continue_execution = False
if (not self.generations_given):
logging.warning(GENERATIONS_MISSING)
self.continue_execution = False------------------------------Here is my line I am getting when I Run the main programme - GeniTools.py: ------------------------------------Please help me know what I need to do in order to run this software without errors. Thank you, Matan. RE: Help with pyGenealogical-Tools (Updated) - Larz60+ - Oct-16-2019 The error message tells all. It can't find a file named INPUT. If the file exists, perhaps it's a path issue. so:
RE: Help with pyGenealogical-Tools (Updated) - Matan_ran - Oct-16-2019 There is no such file named “INPUT” RE: Help with pyGenealogical-Tools (Updated) - Larz60+ - Oct-16-2019 Then how can it be opened? data = reader_input.reader_input("INPUT")
RE: Help with pyGenealogical-Tools (Updated) - Matan_ran - Oct-16-2019 From what I understand the reader_input file is referred as the INPUT file RE: Help with pyGenealogical-Tools (Updated) - Larz60+ - Oct-16-2019 This is plain python. It is looking for a file named 'INPUT' and not finding it. |