FreeTAKTeam / FreeTakServer

Situational Awareness Server compatible with TAK clients
Eclipse Public License 2.0
649 stars 166 forks source link

TypeError: expected str, bytes or os.PathLike object, not PurePosixPath #80

Closed poquex closed 3 years ago

poquex commented 4 years ago

sudo python3 -m FreeTAKServer.controllers.FTS -DataPackageIP [my ip] Traceback (most recent call last): File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/my user/.local/lib/python3.8/site-packages/FreeTAKServer/controllers/FTS.py", line 6, in from FreeTAKServer.controllers.Orchestrator import Orchestrator File "/home/my user/.local/lib/python3.8/site-packages/FreeTAKServer/controllers/Orchestrator.py", line 12, in from FreeTAKServer.controllers.ReceiveConnections import ReceiveConnections File "/home/my user/.local/lib/python3.8/site-packages/FreeTAKServer/controllers/ReceiveConnections.py", line 20, in logger = CreateLoggerController("ReceiveConnections").getLogger() File "/home/my user/.local/lib/python3.8/site-packages/FreeTAKServer/controllers/CreateLoggerController.py", line 14, in init self.logger.addHandler(self.newHandler(loggingConstants.DEBUGLOG, logging.DEBUG, log_format)) File "/home/my user/.local/lib/python3.8/site-packages/FreeTAKServer/controllers/CreateLoggerController.py", line 24, in newHandler handler = RotatingFileHandler( File "/usr/lib/python3.8/logging/handlers.py", line 148, in init BaseRotatingHandler.init(self, filename, mode, encoding, delay) File "/usr/lib/python3.8/logging/handlers.py", line 55, in init logging.FileHandler.init(self, filename, mode, encoding, delay) File "/usr/lib/python3.8/logging/init.py", line 1130, in init filename = os.fspath(filename) TypeError: expected str, bytes or os.PathLike object, not PurePosixPath

I don't know a lot about python but I think the dependencies are fulfilled

pip3 check FreeTakServer No broken requirements found.

Im on Parrot Security OS

brothercorvo commented 4 years ago

Not familiar with Parrot OS, it looks like you have an issue with creating your log file.

poquex commented 4 years ago

any suggestion? Parrot's base on Debian and I'm not running nothing important on this install(literally I'm using Parrot because I had a USB with it laying around), which OS would you suggest if is just to complex to run it on Parrot Os?

brothercorvo commented 4 years ago

We have 100s of Ubuntu installations with no issue. Also Pie 4

naman108 commented 4 years ago

Could you send your createloggercontroller file

poquex commented 4 years ago

from FreeTAKServer.controllers.configuration.LoggingConstants import LoggingConstants from logging.handlers import RotatingFileHandler import logging import sys import os loggingConstants = LoggingConstants() class CreateLoggerController: def init(self, loggername): self.currentpath = os.path.dirname(os.path.realpath(file)) self.logger = logging.getLogger(loggername) self.logger.propagate = True log_format = logging.Formatter(loggingConstants.LOGFORMAT) self.logger.setLevel(logging.DEBUG) self.logger.addHandler(self.newHandler(loggingConstants.DEBUGLOG, logging.DEBUG, log_format)) self.logger.addHandler(self.newHandler(loggingConstants.WARNINGLOG, logging.WARNING, log_format)) self.logger.addHandler(self.newHandler(loggingConstants.INFOLOG, logging.INFO, log_format)) """console = logging.StreamHandler(sys.stdout) console.setFormatter(log_format) console.setLevel(logging.DEBUG) self.logger.info('test') self.logger.addHandler(console)"""

def newHandler(self, filename, log_level, log_format):
    handler = RotatingFileHandler(
        filename,
        maxBytes=loggingConstants.MAXFILESIZE,
        backupCount=loggingConstants.BACKUPCOUNT
    )
    handler.setFormatter(log_format)
    handler.setLevel(log_level)
    return handler

def getLogger(self):
    return self.logger

this is the "CreateLoggerController.py"

poquex commented 4 years ago

but I think I will try on a raspberry pi 3b, if that doesn't work I will just make a Ubuntu install for the server. Still this could be a good tread and I will try to keep the usb stick (yeah, I run out of hard drives so Im running out of a usb) intact to continue this tread in case anybody comes with the same problem in the future.

stagnerk commented 3 years ago

I am getting the same error when starting up a new instance. Fresh Ubuntu Server install.

kelsey@ubuntuserver:~/.local/lib/python3.8/site-packages$ python3 -m FreeTAKServer.controllers.FTS -DataPackageIP xxx.xxx.xxx.xxx Traceback (most recent call last): File "/usr/lib/python3.8/runpy.py", line 193, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.8/runpy.py", line 86, in _run_code exec(code, run_globals) File "/home/kelsey/.local/lib/python3.8/site-packages/FreeTAKServer/controllers/FTS.py", line 6, in from FreeTAKServer.controllers.Orchestrator import Orchestrator File "/home/kelsey/.local/lib/python3.8/site-packages/FreeTAKServer/controllers/Orchestrator.py", line 12, in from FreeTAKServer.controllers.ReceiveConnections import ReceiveConnections File "/home/kelsey/.local/lib/python3.8/site-packages/FreeTAKServer/controllers/ReceiveConnections.py", line 20, in logger = CreateLoggerController("ReceiveConnections").getLogger() File "/home/kelsey/.local/lib/python3.8/site-packages/FreeTAKServer/controllers/CreateLoggerController.py", line 14, in init self.logger.addHandler(self.newHandler(loggingConstants.DEBUGLOG, logging.DEBUG, log_format)) File "/home/kelsey/.local/lib/python3.8/site-packages/FreeTAKServer/controllers/CreateLoggerController.py", line 24, in newHandler handler = RotatingFileHandler( File "/usr/lib/python3.8/logging/handlers.py", line 148, in init BaseRotatingHandler.init(self, filename, mode, encoding, delay) File "/usr/lib/python3.8/logging/handlers.py", line 55, in init logging.FileHandler.init(self, filename, mode, encoding, delay) File "/usr/lib/python3.8/logging/init.py", line 1130, in init filename = os.fspath(filename) TypeError: expected str, bytes or os.PathLike object, not PurePosixPath

kelsey@ubuntuserver:~/.local/lib/python3.8/site-packages$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.1 LTS Release: 20.04 Codename: focal

python3 --version Python 3.8.2

pip3 --version pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

stagnerk commented 3 years ago

I added this to my path export PATH="$PATH:/home/username_here/.local/lib/python3.8/site-packages" and am now able to start the server. I am still unable to connect to it via EUD. Just change user name to match yours.

naman108 commented 3 years ago

have you updated to version 1.3

brothercorvo commented 3 years ago

Closing, because this has probably been addressed in the current 1.3 version