I am the macOS system, and when I try to run a local Python document using the execute command, it always reports an error. I input the command “cd ‘/Users/liran/Desktop/EC 持仓分析’ && /Users/liran/opt/anaconda3/bin/python daily_report.py” in the command line, but the error message keeps saying “Command failed: cd ‘/Users/liran/Desktop/EC 持仓分析’ && /Users/liran/opt/anaconda3/bin/python daily_report.py /bin/sh: cd: line 0: can’t cd to /Users/liran/Desktop/EC: No such file or directory.” However, the document actually exists on my local machine. I don’t know if it’s due to permission issues or some other problem.
Hey @Xianbian_LI ,
Can you please share more details. Are you using npm or docker.
If docker you’d need to map the volume where you’re trying to execute the file.
More info would help us debug
Thanks
how to map the volume?{ "name": "EC期货系统日报工作流_修正版", "nodes": [ { "parameters": { "rule": { "interval": [ { "field": "hours", "hoursInterval": 24, "triggerAtHour": 5, "triggerAtMinute": 0 } ] } }, "id": "schedule-trigger", "name": "定时触发器", "type": "n8n-nodes-base.scheduleTrigger", "position": [ -100, 0 ], "typeVersion": 3.4 }, { "parameters": { "executeOnce": true, "command": "cd '/Users/liran/Desktop/EC持仓框架分析' && /Users/liran/opt/anaconda3/bin/python daily_report.py", "options": {} }, "id": "execute-python-script", "name": "执行Python脚本", "type": "n8n-nodes-base.executeCommand", "position": [ 100, 0 ], "typeVersion": 1 }, { "parameters": { "executeOnce": true, "command": "ls -la '/Users/liran/Desktop/EC持仓框架分析/output'", "options": {} }, "id": "check-output-files", "name": "检查输出文件", "type": "n8n-nodes-base.executeCommand", "position": [ 300, 0 ], "typeVersion": 1 }, { "parameters": { "assignments": { "assignments": [ { "id": "script-output", "name": "脚本输出", "type": "string", "value": "={{ $('execute-python-script').item.json.stdout }}" }, { "id": "file-list", "name": "文件列表", "type": "string", "value": "={{ $('check-output-files').item.json.stdout }}" }, { "id": "execution-time", "name": "执行时间", "type": "string", "value": "={{ $now.setZone('Asia/Shanghai').toFormat('yyyy-MM-dd HH:mm:ss') }}" }, { "id": "current-date", "name": "当前日期", "type": "string", "value": "={{ $now.setZone('Asia/Shanghai').toFormat('yyyyMMdd') }}" } ] }, "options": {} }, "id": "process-output", "name": "处理输出", "type": "n8n-nodes-base.set", "position": [ 500, 0 ], "typeVersion": 3.4 }, { "parameters": { "assignments": { "assignments": [ { "id": "telegram-message", "name": "Telegram消息", "type": "string", "value": "=🏦 *EC期货系统日报*\n📅 {{ $json['当前日期'] }} | ⏰ {{ $json['执行时间'] }}\n━━━━━━━━━━━━━━━━━━━━\n\n📊 *执行结果*\n{{ $json['脚本输出'].split('\n').slice(0, 15).join('\n') }}\n\n📁 *生成文件*\n{{ $json['文件列表'] }}\n\n🎯 *系统状态*: ✅ 正常运行\n📄 报告已生成并保存到本地\n\n_EC期货策略系统自动生成_" } ] }, "options": {} }, "id": "format-message", "name": "格式化消息", "type": "n8n-nodes-base.set", "position": [ 700, 0 ], "typeVersion": 3.4 }, { "parameters": { "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "method": "POST", "url": "https://api.telegram.org/bot<TOKEN>/sendMessage", "sendBody": true, "bodyParameters": { "parameters": [ { "name": "chat_id", "value": "6414409185" }, { "name": "text", "value": "={{ $json['Telegram消息'] }}" }, { "name": "parse_mode", "value": "Markdown" } ] }, "options": {} }, "id": "send-telegram", "name": "发送Telegram消息", "type": "n8n-nodes-base.httpRequest", "position": [ 900, 0 ], "typeVersion": 4.1 }, { "parameters": { "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "method": "POST", "url": "https://api.telegram.org/bot<TOKEN>/sendMessage", "sendBody": true, "bodyParameters": { "parameters": [ { "name": "chat_id", "value": "6414409185" }, { "name": "text", "value": "=❌ *EC期货系统错误通知*\n\n⏰ 时间: {{ $now.setZone('Asia/Shanghai').toFormat('yyyy-MM-dd HH:mm:ss') }}\n\n🚨 错误信息:\n{{ $json.error || $json.stderr || 'Python脚本执行失败' }}\n\n💡 请检查:\n• Python环境是否正常\n• 脚本文件是否存在\n• 文件路径权限是否正确\n• 网络连接是否正常\n\n_自动错误监控_" }, { "name": "parse_mode", "value": "Markdown" } ] }, "options": {} }, "id": "error-notification", "name": "错误通知", "type": "n8n-nodes-base.httpRequest", "position": [ 500, 200 ], "typeVersion": 4.1 } ], "pinData": {}, "connections": { "schedule-trigger": { "main": [ [ { "node": "execute-python-script", "type": "main", "index": 0 } ] ] }, "execute-python-script": { "main": [ [ { "node": "check-output-files", "type": "main", "index": 0 } ], [ { "node": "error-notification", "type": "main", "index": 0 } ] ] }, "check-output-files": { "main": [ [ { "node": "process-output", "type": "main", "index": 0 } ], [ { "node": "error-notification", "type": "main", "index": 0 } ] ] }, "process-output": { "main": [ [ { "node": "format-message", "type": "main", "index": 0 } ] ] }, "format-message": { "main": [ [ { "node": "send-telegram", "type": "main", "index": 0 } ] ] } }, "active": false, "settings": { "timezone": "Asia/Shanghai" }, "versionId": "1.0.1" }
You need to rebuild the container
docker run -d \
--name n8n \
-p 5678:5678 \
-v n8n_data:/home/node/.n8n \
-v /path/to/your/local/folder:/app/data \
docker.n8n.io/n8nio/n8n
It’s this line
-v n8n_data:/home/node/.n8n \
Assuming you use docker run and not docker-compose