Comments (8)
I think it should be
returnData.items = parseShellOutput(returnData.stdout)
from n8n-nodes-python.
Hi @KevinRich651
You can read this section on README https://github.com/naskio/n8n-nodes-python#notes
Actually, the stderr is the one used to pass data the between if the code == 0 otherwise stderr will represent an error.
Could you please provide more details such as your code and the error you are getting ?
from n8n-nodes-python.
hi @naskio
Many thanks for your reply.
Just now I read the note in Readme. Yes, the code logic is as you described.
The entire python code is huge. I removed the irrelevant code, only left the key part related to this issue. The code is as following:
# Get latest filename
filename_query = "SELECT filename......."
####......
print(new_filename)
# 5. Create points file based on rewards, aggregated by ABN & Name
##.........
# 6. Save points file
##...........
# 7. Add new rewards to GBQ table if file sent successfully saved
##...........
# 8. Update log table
points_amt = all_points_owed['points_amt'].sum()
query_string = f"""
INSERT INTO ..........
"""
update = client.query(query_string).result()
fileNames = [{'filename':new_filename}]
print(fileNames)
return fileNames #CHANGE
- In the above code,
print(fileNames)
can be executed normally, and the fileNames is as expected:
[{'filename': 'AWALLX03P.079'}]
But this python node still failed. - The failure reason I got on the n8n webpage is out of memory as the screenshot:
![image](https://private-user-images.githubusercontent.com/133220604/259918431-594f8097-4942-4a0f-a19d-759c210e516c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE0MjkyMzUsIm5iZiI6MTcyMTQyODkzNSwicGF0aCI6Ii8xMzMyMjA2MDQvMjU5OTE4NDMxLTU5NGY4MDk3LTQ5NDItNGEwZi1hMTlkLTc1OWMyMTBlNTE2Yy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzE5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxOVQyMjQyMTVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1lM2UzYjFiYTRkNzNhY2FhYjA4YzFjMzQ0NmVhMjJmODI5NWRiN2I2ODk3ZWRmNzY1YWZkMTk5OTlhNTBjNDg2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.HJahPTidiJaSYXXtnQP2_r4GAzT7F-gmY2my8ouErCw)
- But I the error I got on GCP logging (the n8n is self-hosted on GCP container) as following:
![image](https://private-user-images.githubusercontent.com/133220604/259918822-a42eec4a-c97e-4eb6-8cb7-15d91ec66392.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE0MjkyMzUsIm5iZiI6MTcyMTQyODkzNSwicGF0aCI6Ii8xMzMyMjA2MDQvMjU5OTE4ODIyLWE0MmVlYzRhLWM5N2UtNGViNi04Y2I3LTE1ZDkxZWM2NjM5Mi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzE5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxOVQyMjQyMTVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02NmJhMWRlNTc3OTZkOWExZDVjODgxYmU2MzMwZDA5ZDUyMjdjZWFmODdkMmYzYzBmZWUwZDc2NDdjYTRjYTA1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.IahR4erRvP-rYRP2F2Pd3P3GZHxBuuHAgGZwB6AKME8)
from n8n-nodes-python.
hi @naskio any ideas about this issue? Thank you in advance.
from n8n-nodes-python.
hi @naskio would you mind to take a brief look at this issue. Perhaps a cue from you will help me a lot.
from n8n-nodes-python.
Hi @KevinRich651
I don't think that the error is related to this package.
I suggest that you move all the code related to read/write data to DB outside the PythonNode
and keep only the processing part in the PythonNode, and move the queries to different nodes (You may find other nodes that will simplify the integration with the DB).
from n8n-nodes-python.
Thanks for your suggestion. I will take a try.
I am still confused why the error response in n8n web page and cloud logging is totally different?
from n8n-nodes-python.
hi @naskio I located the accurate line, which triggers the failure. I have never encountered so weird a issue...
try:
# Bonus points offer, valid for KYC Pass Date >= 2023-06-01 & <= 2023-07-31
qbr_eofy_new = all_data.copy()
qbr_eofy_new = qbr_eofy_new[(qbr_eofy_new['kyc_pass_date']>=date(2023,6,1)) & (qbr_eofy_new['kyc_pass_date']<=date(2023,7,31))]
qbr_eofy_new100k = qbr_eofy_new[(qbr_eofy_new['f_60_aud_fx_volume']>=50000)]
qbr_eofy_new100k['points_owed_to_date'] = 100000
except:
print("error")
print(qbr_eofy_new100k)
print(items)
return items
In the above code, all_data is a pandas Dataframe containing hundreds of rows.
It can run normally and output what I expect, no error log and items is a valid json array from the previous node.
But the workflow node PythonFunction
containing the code still fail for an unknown reason...
But if I comment or remove the line qbr_eofy_new100k['points_owed_to_date'] = 100000
The workflow can function normally without any error... I have no idea what's wrong with such a simple code.
I run the above code in local environment, the code also runs normally.
My thoughts:
In the GCP logging, I still get the same error as I attached couple weeks ago.
But now I think that error SyntaxError: Unexpected token / in JSON at position 0
is not the root cause.
the return value items
in the code didn't really return.
What weird! Hope to get some suggestions from you
from n8n-nodes-python.
Related Issues (15)
- PythonFunction: Node does not require credentials HOT 8
- import Python modules in py_scripts directory HOT 1
- Error when parsing output of PythonFunction HOT 4
- Debian docker image outdated HOT 1
- No Python Node HOT 1
- Q's from a new user that could be clearer in the readme
- Question: How to receive value from previous nodes? HOT 1
- ERROR: spawn E2BIG [Line 408] HOT 4
- Question: How to access the binary data? HOT 2
- Can't run python with npm package HOT 12
- Error when importing workflow.json
- Getting OOM error while running python node HOT 3
- Error fetching feature flags ReferenceError: AbortSignal is not defined
- ERROR: exitCode: 0 spawn python3 ENOENT HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from n8n-nodes-python.