#!/usr/bin/env python3

import sys
import os

def print_significant_lines(file_path):
    try:
        with open(file_path, 'r') as file:
            for line in file:
                # Strip whitespace from the beginning and end of the line
                stripped_line = line.strip()
                
                # Check if the line is not empty, not whitespace, and not a comment
                if stripped_line and not stripped_line.startswith('#'):
                    print(line.rstrip())  # Print the line without trailing newline
    except FileNotFoundError:
        print(f"Error: File '{file_path}' not found.", file=sys.stderr)
    except IOError:
        print(f"Error: Unable to read file '{file_path}'.", file=sys.stderr)

if __name__ == "__main__":
    if len(sys.argv) != 2:
        print("Usage: nocomment <file_path>", file=sys.stderr)
        sys.exit(1)

    file_path = sys.argv[1]
    print_significant_lines(file_path)