Tim
Tim

Reputation: 43

'Parameter "self" unfilled' error in PyCharm when attempting to access method in another class

I am using PyCharm. I keep getting this error "Parameter self unfilled" on all my of method calls to methods in other classes and I can't for the life of me figure it out. In this particular instance, it actually says "Parameter final_formatted_filename unfilled" because it's taking that argument as the self argument. What am I missing?

FileHandler.py

from LogHandler import LogHandler
import Main


class FileHandler:

      def format_file_name_output(self, owner_name):
          date_and_time = self.main.Main.date_and_time_snapshot()
          final_formatted_filename = (owner_name + " (" + date_and_time[0] + "_" + date_and_time[1] + ")")
          LogHandler.create_new_log(final_formatted_filename)

LogHandler.py

class LogHandler:

    def __init__(self, log_file):
        self.log_file = log_file

    def create_new_log(self, final_formatted_filename):
        self.log_file = open(final_formatted_filename + " Log.txt", 'w+', encoding='utf-8')

The last parenthesis in the last line of FileHandler.py is what is highlighted with the aforementioned error: "Parameter final_formatted_filename unfilled". My code is riddled with this error. Any help would be greatly appreciated. Thanks!

Upvotes: 4

Views: 18803

Answers (1)

JBirdVegas
JBirdVegas

Reputation: 11403

You need to create an instance of LogHandler then you can call the method create_new_log on the instance.

handler = LogHandler()
handler.create_new_log(final_formatted_filename)

Upvotes: 11

Related Questions