0

I'm trying to create a private Python index using PyPiServer using the API.

According to the documentation I can specify the verbosity and the log file in the pypiserver app setup.

This is what I have:

import pypiserver 
from pypiserver import bottle


app = pypiserver.app(root='./packages', password_file='.htpasswd', verbosity=4, log_file='F:\repo\logfile.txt')

bottle.run(app=app, host='itdevws09', port=8181, server='auto')

However when I start it using python mypyserver.py, the index starts up normally and works, however no log file is created. If I create one manually, the log file isn't actually written to.

If I start the pypiserver using the command line using:

pypi-server -p 8080 -P .htpasswd -vvvv --log-file F:/repo/logfile.txt ./packages

The log file is created and written to as normal.

I have tried putting the log-file and verbosity in the bottle.run() method but that doesn't work either. How can I get the logging to work?

Baldeep
  • 4,213
  • 4
  • 17
  • 17
  • I suspect the problem in `log_file='F:\repo\logfile.txt'`. `\r` in Python is a special character. Protect backslashes by either doublign them (`log_file='F:\\repo\\logfile.txt'`) or using raw strings (`log_file=r'F:\repo\logfile.txt'`). – phd Nov 01 '17 at 19:58
  • Thanks for your help, I tried that, and now I'm getting a different error. `C:\ProgramData\Anaconda3\lib\re.py:301: DeprecationWarning: Flags not at the start of the expression ((?mx) # ver (truncated) p = sre_compile.compile(pattern, flags) C:\ProgramData\Anaconda3\lib\sre_parse.py:763: DeprecationWarning: Flags not at the start of the expression \{\{((?:((?mx) (truncated) p = _parse_sub(source, state, sub_verbose)` – Baldeep Nov 02 '17 at 09:54
  • It's just a warning, not an error. Something slightly wrong in a regular expression. But without looking at the code and data it's hard to say what's wrong. – phd Nov 02 '17 at 10:10
  • That's true, I missed that somehow. All the code I have is what's in the main question, I want to eventually add different authentication, hence why I need to have it like this. A workaround I have for now is to create a bat file which starts the repository through the command line, which will do for now I guess. – Baldeep Nov 02 '17 at 10:31

0 Answers0