Jeffrey Omar
03/10/2025, 8:50 AM(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>
Theom
03/10/2025, 10:02 AMpefect 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.Jeffrey Omar
03/10/2025, 1:38 PMTheom
03/10/2025, 1:41 PMJeffrey Omar
03/10/2025, 2:38 PM(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'.
Jeffrey Omar
03/10/2025, 2:39 PM(venv) PS C:\Users\User\Desktop\Projects\Clients\tongs-web-scraper> Remove-Item Env:PREFECT_API_URL
Jeffrey Omar
03/10/2025, 2:39 PMJeffrey Omar
03/10/2025, 2:49 PM