<@ULVA73B9P> When running a deploy script that ref...
# marvin-in-the-wild
a
@Marvin When running a deploy script that references a flow which includes a custom block I'm receiving the following error. The blocks are registered in Prefect Cloud. They're saved in a "blocks" folder in my working directory and imported like this: from blocks.keap import Keap from blocks.postgresql import PostgreSQL What am I doing wrong?
Copy code
Traceback (most recent call last):
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "C:\Users\ALEXAN~1.FOR\AppData\Local\Temp\tmp0efqm10e\data-pipeline-main\flows\keap\keap_contact_sync.py", line 6, in <module>
ImportError: cannot import name 'Keap' from 'prefect.blocks.system' (C:\Users\Alexander.Ford\Dev\data-pipeline\venv\Lib\site-packages\prefect\blocks\system.py)

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

Traceback (most recent call last):
  File "C:\Users\Alexander.Ford\Dev\data-pipeline\deployments\man-on-fire\mof_keap_contact_sync.py", line 36, in <module>
    deploy()
  File "C:\Users\Alexander.Ford\Dev\data-pipeline\deployments\man-on-fire\mof_keap_contact_sync.py", line 18, in deploy
    flow.from_source(
  File "C:\Users\Alexander.Ford\Dev\data-pipeline\venv\Lib\site-packages\prefect\utilities\asyncutils.py", line 259, in coroutine_wrapper
    return call()
           ^^^^^^
  File "C:\Users\Alexander.Ford\Dev\data-pipeline\venv\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 432, in __call__
    return self.result()
           ^^^^^^^^^^^^^
  File "C:\Users\Alexander.Ford\Dev\data-pipeline\venv\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 318, in result
    return self.future.result(timeout=timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Alexander.Ford\Dev\data-pipeline\venv\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 179, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Alexander.Ford\AppData\Local\Programs\Python\Python312\Lib\concurrent\futures\_base.py", line 401, in __get_result
    raise self._exception
  File "C:\Users\Alexander.Ford\Dev\data-pipeline\venv\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 389, in _run_async
    result = await coro
             ^^^^^^^^^^
  File "C:\Users\Alexander.Ford\Dev\data-pipeline\venv\Lib\site-packages\prefect\flows.py", line 940, in from_source
    flow: "Flow" = await from_async.wait_for_call_in_new_thread(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Alexander.Ford\Dev\data-pipeline\venv\Lib\site-packages\prefect\_internal\concurrency\api.py", line 164, in wait_for_call_in_new_thread
    return call.result()
           ^^^^^^^^^^^^^
  File "C:\Users\Alexander.Ford\Dev\data-pipeline\venv\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 318, in result
    return self.future.result(timeout=timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Alexander.Ford\Dev\data-pipeline\venv\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 179, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Alexander.Ford\AppData\Local\Programs\Python\Python312\Lib\concurrent\futures\_base.py", line 401, in __get_result
    raise self._exception
  File "C:\Users\Alexander.Ford\Dev\data-pipeline\venv\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 352, in _run_sync
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Alexander.Ford\Dev\data-pipeline\venv\Lib\site-packages\prefect\flows.py", line 1667, in load_flow_from_entrypoint
    flow = import_object(entrypoint)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Alexander.Ford\Dev\data-pipeline\venv\Lib\site-packages\prefect\utilities\importtools.py", line 201, in import_object
    module = load_script_as_module(script_path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Alexander.Ford\Dev\data-pipeline\venv\Lib\site-packages\prefect\utilities\importtools.py", line 164, in load_script_as_module
    raise ScriptError(user_exc=exc, path=path) from exc
prefect.exceptions.ScriptError: Script at 'C:\\Users\\ALEXAN~1.FOR\\AppData\\Local\\Temp\\tmp0efqm10e\\data-pipeline-main\\flows\\keap\\keap_contact_sync.py' encountered an exception: ImportError("cannot import name 'Keap' from 'prefect.blocks.system' (C:\\Users\\Alexander.Ford\\Dev\\data-pipeline\\venv\\Lib\\site-packages\\prefect\\blocks\\system.py)")
m
Your message was too long by 989 tokens - please shorten it and try again. For reference, here's your message at the allowed limit:
When running a deploy script that references a flow which includes a custom block I'm receiving the following error. The blocks are registered in Prefect Cloud. They're saved in a "blocks" folder in my working directory and imported like this:
from blocks.keap import Keap from blocks.postgresql import PostgreSQL What am I doing wrong? ```Traceback (most recent call last): File "<frozen importlib._bootstrap_external>", line 995, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "C:\Users\ALEXAN~1.FOR\AppData\Local\Temp\tmp0efqm10e\data-pipeline-main\flows\keap\keap_contact_sync.py", line 6, in <module> ImportError: cannot import name 'Keap' from 'prefect.blocks.system' (C:\Users\Alexander.Ford\Dev\data-pipeline\venv\Lib\site-packages\prefect\blocks\system.py) The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\Alexander.Ford\Dev\data-pipeline\deployments\man-on-fire\mof_keap_contact_sync.py", line 36, in <module> deploy() File "C:\Users\Alexander.Ford\Dev\data