R
Railway

✋|help

Error with discord bot using go and python

Rrokochi9/3/2023
I am new to asking questions in a place like this, so please forgive me if there are any problems

I have created a discord bot that uses Go as its main language and responds with openai api(python). When I run it, I get an error that python3 not found (I modified the code to say "python" and get the same error). How can this be resolved?

[error message]
Command failed: exit status 127, Stderr: /bin/sh: 1: python3: not found
Solution:
this is the golang package I've used for a chatgpt telegram bot
https://github.com/ayush6624/go-chatgpt
Jump to solution
Rrokochi9/3/2023
N/A
Rrokochi9/3/2023
AAdam9/3/2023
Add python to a nixpacks.toml as a provider https://nixpacks.com/docs/configuration/file
BBrody9/3/2023
also golang has a good openapi package
Rrokochi9/3/2023
Thank you for your reply.
Create a file called "nixpacks.toml",

providers = ['...' , 'python']

I tried typing it in, but I still get the same error
AAdam9/3/2023
What directory is the file in?
Please share your repo if possible
Rrokochi9/3/2023
Oh, really? Then maybe it is better that way. I'm trying to replace the bot I've been creating all in python with go...
BBrody9/3/2023
that's very admirable
Rrokochi9/3/2023
It's a private repository, but it's not open to the public, so it's fine if you want to show it to others. I don't know how to do this
hehe(???)
BBrody9/3/2023
adding python to the providers wouldn't work, nixpacks runs your go app in a slim image that only copy's over the contents of the repo, leaving out python
AAdam9/3/2023
Ah didn't know that. This error in js is fixed with the nixpacks file
BBrody9/3/2023
golang's provider is special
AAdam9/3/2023
I trust Brody on the Go side, if they say that Go works for the bot then Go works
BBrody9/3/2023
and as aleks has told me before, you'd actually wanna add python(38/310/311) as a nixPkgs instead of a provider
we can get it to stop running your go app in a slim image if youd like to use python for the time being roko?
Rrokochi9/3/2023
To be honest, I was motivated to try a statically typed language because I often fell down with python, and I would be happy if I could think in the direction of eradicating python in my programs if possible (is this the answer?)
BBrody9/3/2023
hell yeah I love to hear that
Rrokochi9/3/2023
By the way, I tried to install python in a dockerfile earlier and it looked like I could do it, so can I do it in that direction? I thought so, but I didn't understand the specification of dockerfile, so I was dreary(?)
BBrody9/3/2023
you totally could do that, but I recommend sticking with nixpacks unless you have a decent reason to not want to use it
Rrokochi9/3/2023
Well, but I'll go in this direction for now
"golang has a good openapi package"
ok, thanks
BBrody9/3/2023
also you can return more than one value from a go function, so you'd want to have the return type of the function be (string, error) so when there's an error you can do a return "", err
Rrokochi9/3/2023
Oh, I knew it.
Today is actually the first time I've touched golang, and I'm writing code while talking to chatgpt. But I had a sneaking suspicion that I could do something like you talk about while writing lol
BBrody9/3/2023
I assume the python script is talking to chatgpt right?
Rrokochi9/3/2023
yes, I am building a bot using openai api, talking to the web version of chatgpt
Solution
BBrody9/3/2023
this is the golang package I've used for a chatgpt telegram bot
https://github.com/ayush6624/go-chatgpt
Rrokochi9/3/2023
you might be God:cooldoge:
BBrody9/3/2023
I just really like go 🙂
Rrokochi9/3/2023
I"ll try this for now. Thanks a lot. I'll close this thread
BBrody9/3/2023
no need to close
I will just simply mark as solved
AAdam9/3/2023
You can also do this with python
Multiple returns are returned as a tuple which you can access the same way
I won't stand for this python slander
BBrody9/3/2023
haha I didn't say you can't do it with python, I only said that because the go function they showed was a single return value
AAdam9/3/2023
:ross_gun:
BBrody9/3/2023
python is king, he says nervously
Rrokochi9/3/2023
The package was successfully completed using the previously mentioned package! Thank you so much
BBrody9/3/2023
no problem!
Rrokochi9/3/2023
I personally just have a piece of junk brain that makes more mistakes with dynamic typing... sorry if I offended you
BBrody9/3/2023
no worries you didnt say anything bad at all, im the same way, i work better with go then i would python or javascript

Looking for more? Join the community!

Recommended Posts
Selenium driver unable to fetch page in Selenium deploymentI am facing an issue while deploying my app via railway.app. 

Here is the description of the app: I up loaded Tesseract-OCR Folder on gitup but on railway cant't findpytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your PATH.How to enable Email on CloudflareI have a React/NodeJS app running on Railway using a custom domain. Cloudflare DNS records have beeUnused DatabaseHey, I have a backend talking to my express server. Both are hosted on Railway. The thing is I am noRun a command in production (rake)Hi there, newcomer from Heroku here — I need to run a command in my production environment (in this don't remember how to log in into my accountI need to access to my account to suspend something, but I faced this notification (in the picture) Run a daily rails rake script on cronHi I have an app that does a daily update to the data in the db. Currently using railway I run this typebot internal server errortypebot is experiencing internal server error. What is the solution?Internal Server ErrorI have this problem, i need helpSpringBoot with MySQL on railway setupHey I am learning SpringBoot and was working locally with a MySQL db set up(locally as well), and I Laravel: failed to build projectHello, I am new to Railway. I am trying to deploy laravel project from my github repo, which is a rePricing questioni got 10 eur in credits because that lowest i could go and got hobby plan 5 eur a month, but after mGithub being in privateHello, I'm having this return with my github being in private. [Evolution API] v1.5.0 1 - Sat Sep 02Yt-DlHey i recently just got railway n found out yt-dl is banned for some reason i just wanted to host mySSH to Wordpress instanceI would like to ssh to my wp instance volume to make changes to the source code there. Is there way Add search to Postgres TableViewI have a problem, big table and I need change some rows but can't find it and update without sql reqDoes anyone know what the procfile command should be for Django Daphne?I'm trying to move from wsgi to asgi in Django and not sure what the procfile command should be. I'Does anyone know what the procfile should be for daphne?I'm trying to move from wsgi to asgi in Django and not sure what the procfile command should be. I'No data is being written to the fileHi all. When I start my telegram bot, I log messages. All messages are written to a text document. WBuild failed but not sure whyHi! I'm trying to understand why my build failed, and I can't discern any errors in the logs. Here's