#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, getopt
import uuid
log_file_directory = "/home/pi/logs" # don't use a '/' at the end!
log_file_name = "sniffed.txt"
def main(argv):
opts, args = getopt.getopt(argv,"s:")
for opt, arg in opts:
if opt == '-s': #meaning there's valid args/codes in it
full_log_file_name = log_file_directory + "/" + log_file_name
with open(full_log_file_name, 'a') as outfile:
sniffed_code = arg + "\n"
outfile.write(sniffed_code)
if __name__ == "__main__":
main(sys.argv[1:])
Wenn ich es starte kommt aber :
Call python /home/pi/bin/sniffer.py -s 13057193
File "/home/pi/bin/sniffer.py", line 17
with open(full_log_file_name, 'a') as outfile:
^
IndentationError: unexpected indent
Dachte es liegt am Dateipfad aber das war es wohl nicht

danke schonmal