This topic was automatically generated from Slack. You can find the original thread here.
What is the python package name for the export function? When I try: **from** pipedream.script_helpers **import** (steps, export)
I get the following error: ModuleNotFoundError No module named 'pipedream.script_helpers'
I’m sorry for the confusion, but the code you’re trying to run seems to be intended for a Pipedream component, which is a serverless function that runs in the Pipedream environment, not a local Python environment. In Pipedream, steps and export are provided as part of the execution context and are not imported from a Python package. They are used within the Pipedream platform to reference previous steps in a workflow and to export data from a step, respectively. If you’re trying to run this code outside of Pipedream, you’ll need to replace these Pipedream-specific constructs with equivalent code that works in your environment. If you’re trying to run this within a Pipedream workflow, you should be writing the code in the Pipedream UI, not in a local Python environment. If you need further assistance, please visit https://pipedream.com/support for more support options.
could you share the full code where you’re seeing that error? There’s a little magic that we do behind the scenes so I’d like to see the exact code to help troubleshoot
Yes, the docs do need updating but the examples in the docs do work. We basically support two environments for Python:
The docs right now reference the “scripting” environment where you can copy and paste any Python code and it should just work. In that case you can also use the pipedream.script_helpers package to access steps and the export function.
You can also use Pipedream components in Python steps, where you use the handler (def handler(pd: "pipedream"):). The handler function defines a component just like in Node.js, where you have access to connected account data, data stores, and other Pipedream-specific features.
So the examples in the core docs do work as-is, but when you define the handler function, the manner in which we parse and execute the code is different, which is why you’re seeing the error message you are.
Python support is still in beta. We shipped with approach #1 and we’ve been iterating on making #2 the default approach. I made a note to update the docs clarify all of this + more about this specific error.
I’m glad you reached out because I know this is confusing and we absolutely do need to update the docs… a lot of docs need some love! Easier to write code than English