|
6 | 6 | __author__ = 'Simon Robinson' |
7 | 7 | __copyright__ = 'Copyright (c) 2023 Simon Robinson' |
8 | 8 | __license__ = 'Apache 2.0' |
9 | | -__version__ = '2023-11-06' # ISO 8601 (YYYY-MM-DD) |
| 9 | +__version__ = '2023-11-10' # ISO 8601 (YYYY-MM-DD) |
10 | 10 | __package_version__ = '.'.join([str(int(i)) for i in __version__.split('-')]) # for pyproject.toml usage only |
11 | 11 |
|
12 | 12 | import abc |
@@ -240,8 +240,9 @@ def initialise(log_file=None): |
240 | 240 | Log._LOGGER = logging.getLogger(APP_NAME) |
241 | 241 | if log_file or sys.platform == 'win32': |
242 | 242 | handler = logging.handlers.RotatingFileHandler( |
243 | | - log_file or '%s/%s.log' % (os.path.dirname(sys.executable if getattr(sys, 'frozen', False) else |
244 | | - os.path.realpath(__file__)), APP_SHORT_NAME), |
| 243 | + log_file or os.path.join(os.getcwd() if __package__ is not None else |
| 244 | + os.path.dirname(sys.executable if getattr(sys, 'frozen', False) else |
| 245 | + os.path.realpath(__file__)), '%s.log' % APP_SHORT_NAME), |
245 | 246 | maxBytes=LOG_FILE_MAX_SIZE, backupCount=LOG_FILE_MAX_BACKUPS) |
246 | 247 | handler.setFormatter(logging.Formatter('%(asctime)s: %(message)s')) |
247 | 248 |
|
@@ -2815,7 +2816,10 @@ def get_script_start_command(self, quote_args=True): |
2815 | 2816 |
|
2816 | 2817 | script_command = [python_command] |
2817 | 2818 | if not getattr(sys, 'frozen', False): # no need for the script path if using pyinstaller |
2818 | | - script_command.append(os.path.realpath(__file__)) |
| 2819 | + if __package__ is not None: |
| 2820 | + script_command.extend(['-m', APP_SHORT_NAME]) |
| 2821 | + else: |
| 2822 | + script_command.append(os.path.realpath(__file__)) |
2819 | 2823 |
|
2820 | 2824 | # preserve any arguments - note that some are configurable in the GUI, so sys.argv may not be their actual state |
2821 | 2825 | script_command.extend(arg for arg in sys.argv[1:] if arg not in ('--debug', '--external-auth')) |
|
0 commit comments