Python Forum
Help with pyGenealogical-Tools (Updated)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with pyGenealogical-Tools (Updated)
#1
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/pyGenealogicalT...escription

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:

--------------

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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:

Error:
Traceback (most recent call last): File "C:/Users/97252/PycharmProjects/Girffe/matan.py", line 51, in <module> main() File "C:/Users/97252/PycharmProjects/Girffe/matan.py", line 21, in main data = reader_input.reader_input("INPUT") File "C:\Users\97252\PycharmProjects\Girffe\venv\lib\site-packages\parser_input\reader_input.py", line 9, in __init__ self.file = open(file_path, "r") FileNotFoundError: [Errno 2] No such file or directory: 'INPUT' Process finished with exit code 1
------------------------------------

Please help me know what I need to do in order to run this software without errors.

Thank you,

Matan.
Reply
#2
The error message tells all. It can't find a file named INPUT.
If the file exists, perhaps it's a path issue.
so:
  • Does the file exist?
  • is INPUT a declared constant? (if so, remove quotes around INPUT)
  • is the file located is the Current working directory?
Reply
#3
There is no such file named “INPUT”
Reply
#4
Then how can it be opened?
data = reader_input.reader_input("INPUT")
Reply
#5
From what I understand the reader_input file is referred as the INPUT file
Reply
#6
This is plain python.
It is looking for a file named 'INPUT' and not finding it.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Mysql Workbench table not updated CatBall 2 2,143 Feb-13-2023, 05:37 PM
Last Post: CatBall
  live updated json file Nyanpasu 2 2,996 Aug-22-2020, 04:41 PM
Last Post: Nyanpasu
  Multiple items of a matrix has been updated. Yoki91 4 3,352 May-19-2020, 06:29 PM
Last Post: Yoki91
  Verify if .docx table of contents is updated as per document sections or not vintysaw 0 5,482 Oct-24-2019, 12:01 PM
Last Post: vintysaw
  video processing tools sveto4ka 2 2,575 Oct-23-2019, 01:27 PM
Last Post: sveto4ka
  dictionary of dictionaries, to be updated Skaperen 2 3,172 Mar-03-2019, 07:15 AM
Last Post: Skaperen
  Updated security logger jameseroni 0 2,473 Oct-29-2018, 04:23 AM
Last Post: jameseroni
  Mouse click movements? [UPDATED] minnaadel 3 4,640 Mar-31-2018, 05:15 PM
Last Post: woooee

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020