ImportError: cannot import name 'start_http_server' from 'prometheus_client' (Python 3.7.0a2)
See original GitHub issueHello,
OS Windows 8.1 Python 3.7.0a2
tryed to excute code
#!/usr/local/bin/python
# coding: utf-8
from prometheus_client import start_http_server, Summary
import random
import time
# Create a metric to track time spent and requests made.
REQUEST_TIME = Summary('request_processing_seconds', 'Time spent processing request')
# Decorate function with metric.
@REQUEST_TIME.time()
def process_request(t):
"""A dummy function that takes some time."""
time.sleep(t)
if __name__ == '__main__':
# Start up the server to expose the metrics.
start_http_server(8000)
# Generate some requests.
while True:
process_request(random.random())
returned error
Traceback (most recent call last):
File "C:/Server/Repositories/Projects/um_open/templates/Test/prometheus_client.py", line 4, in <module>
from prometheus_client import start_http_server, Summary
File "C:\Server\Repositories\Projects\um_open\templates\Test\prometheus_client.py", line 4, in <module>
from prometheus_client import start_http_server, Summary
ImportError: cannot import name 'start_http_server' from 'prometheus_client' (C:\Server\Repositories\Projects\um_open\templates\Test\prometheus_client.py)
How solve this problem?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
prometheus_client ImportError: cannot import name 'Info'
Code runs just fine when I use 2.7 python interpreter. However in 3.6 it gives: ImportError: cannot import name 'Info'
Read more >Prometheus_client can be used on OS windows and python ...
Hello, try to wrote prometheus_client took simple code, #!/usr/local/bin/python # coding: utf-8 from prometheus_client import ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I understood where was mistake, name my python app same with name file in module prometheus_client
returned after executed python script
import sys from pprint import pprint as p p(sys.path)