This is the logs i am getting ```(venv) PS D:\cod...
# ask-community
j
This is the logs i am getting
Copy code
(venv) PS D:\coding\python\simple_hello> python test.py
Traceback (most recent call last):
  File "D:\coding\python\simple_hello\venv\Lib\site-packages\prefect\client\orchestration\__init__.py", line 1524, in raise_for_api_version_mismatch
    api_version = self.api_version()
                  ^^^^^^^^^^^^^^^^^^
  File "D:\coding\python\simple_hello\venv\Lib\site-packages\prefect\client\orchestration\__init__.py", line 1513, in api_version
    return res.json()
           ^^^^^^^^^^
  File "D:\coding\python\simple_hello\venv\Lib\site-packages\httpx\_models.py", line 832, in json
    return jsonlib.loads(self.content, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\coding\python\simple_hello\test.py", line 34, in <module>
    show_stars([
  File "D:\coding\python\simple_hello\venv\Lib\site-packages\prefect\flows.py", line 1648, in __call__
    return run_flow(
           ^^^^^^^^^
  File "D:\coding\python\simple_hello\venv\Lib\site-packages\prefect\flow_engine.py", line 1530, in run_flow
    ret_val = run_flow_sync(**kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\coding\python\simple_hello\venv\Lib\site-packages\prefect\flow_engine.py", line 1370, in run_flow_sync
    with engine.start():
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "D:\coding\python\simple_hello\venv\Lib\site-packages\prefect\flow_engine.py", line 742, in start
    with self.initialize_run():
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "D:\coding\python\simple_hello\venv\Lib\site-packages\prefect\flow_engine.py", line 672, in initialize_run
    with SyncClientContext.get_or_create() as client_ctx:
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "D:\coding\python\simple_hello\venv\Lib\site-packages\prefect\context.py", line 241, in get_or_create
    with cls() as ctx:
  File "D:\coding\python\simple_hello\venv\Lib\site-packages\prefect\context.py", line 223, in __enter__
    self.client.raise_for_api_version_mismatch()
  File "D:\coding\python\simple_hello\venv\Lib\site-packages\prefect\client\orchestration\__init__.py", line 1528, in raise_for_api_version_mismatch
    raise RuntimeError(f"Failed to reach API at {self.api_url}") from e
RuntimeError: Failed to reach API at <http://127.0.0.1:4200>
(venv) PS D:\coding\python\simple_hello>
t
I think you don't have a prefect server running or you did not set the right API URL. If it's the former, run
pefect server start
in a separate terminal before running your flow. If it's the latter, specify the
PREFECT_API_URL
variable before running your flow.
j
I do have the server set. API and is running at http://127.0.0.1:4200 and i still get the same error
t
Then try setting the PREFECT_API_URL before running your workflow. But it should work by default.
j
Okie Gang!! I solved it. with the help of chatGPT. anyways I did this, just following the terminals responses.
Copy code
(venv) PS C:\Users\User\Desktop\Projects\Clients\tongs-web-scraper> prefect config set PREFECT_API_URL="<http://127.0.0.1:4200/api>"
Set 'PREFECT_API_URL' to '<http://127.0.0.1:4200/api>'.
PREFECT_API_URL is also set by an environment variable which will override your  
config value. Run `unset PREFECT_API_URL` to clear it.
Updated profile 'local'.
Than i just did this in the terminal
Copy code
(venv) PS C:\Users\User\Desktop\Projects\Clients\tongs-web-scraper> Remove-Item Env:PREFECT_API_URL
After that prefect ran like normal. Golly GEE!!! this was a rollar coaster. was about to abandon this project
Okie Now I am not seeing my flows