Any way to work with SFTP?
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
-
- Newbie
- Posts: 22
- Joined: Wed Jun 21, 2023 3:34 am
- Projects: Yandere pjSEKAI boys (Yandere Rui)
- Discord: nofanru
- Contact:
Any way to work with SFTP?
I really need the ability to send data to an SFTP server
I tried to use the paramiko library.
I installed it, as stated in the documentation, in the game/python-packages folder, tried to import it in the init python block, as well as in a separate .py file and imported this file to call the function, in all cases the game just crashes without any errors. I also tried to import only parts, like paramiko.Transport, but that also didn’t give anything
So now I'm stumped and have no idea what to do about it. I would be grateful for any help!
Updated: If I understand correctly, then for paramiko to work I need to compile my own version of renpy from source code. I still hope to find an easier way :<
I tried to use the paramiko library.
I installed it, as stated in the documentation, in the game/python-packages folder, tried to import it in the init python block, as well as in a separate .py file and imported this file to call the function, in all cases the game just crashes without any errors. I also tried to import only parts, like paramiko.Transport, but that also didn’t give anything
So now I'm stumped and have no idea what to do about it. I would be grateful for any help!
Updated: If I understand correctly, then for paramiko to work I need to compile my own version of renpy from source code. I still hope to find an easier way :<
Last edited by NoFanru on Sun May 26, 2024 1:34 pm, edited 1 time in total.
-
- Regular
- Posts: 83
- Joined: Sat May 04, 2024 10:40 pm
- Contact:
Re: Any way to work with SFTP?
I think error happens before game starts. Make code such to start game and then call that code.if error happens renpy ll show it.and you cant use all python modules in renpy. I searched earlier and they saying only pure python works.search pure python sftp and try it
-
- Newbie
- Posts: 22
- Joined: Wed Jun 21, 2023 3:34 am
- Projects: Yandere pjSEKAI boys (Yandere Rui)
- Discord: nofanru
- Contact:
Re: Any way to work with SFTP?
Thanks for the answergiorgi1111 wrote: ↑Sun May 26, 2024 10:00 am I think error happens before game starts. Make code such to start game and then call that code.if error happens renpy ll show it.and you cant use all python modules in renpy. I searched earlier and they saying only pure python works.search pure python sftp and try it
I created a function where the library is imported. The game starts, but when it reaches the execution of this function it also crashes without any error (log, traceback, errors also do not change)
Pure python sftp sounds good, but everything I find on the internet comes down to poramiko :<
-
- Regular
- Posts: 83
- Joined: Sat May 04, 2024 10:40 pm
- Contact:
Re: Any way to work with SFTP?
Show code where you using function. Im using renpy 8.0.3 . I put pymysql in renpy8.0.3/lib/python3.9 and importing straight import pymysql. Also for first use for test i calling it earlier and game was starting and crashing without error.then used where i needed mysql function and it was showing errors.now if xampp isnot launched game crashes at start but showing error in text file.
-
- Newbie
- Posts: 22
- Joined: Wed Jun 21, 2023 3:34 am
- Projects: Yandere pjSEKAI boys (Yandere Rui)
- Discord: nofanru
- Contact:
Re: Any way to work with SFTP?
I simply wrote import paramiko in the function:giorgi1111 wrote: ↑Sun May 26, 2024 10:46 am Show code where you using function. Im using renpy 8.0.3 . I put pymysql in renpy8.0.3/lib/python3.9 and importing straight import pymysql. Also for first use for test i calling it earlier and game was starting and crashing without error.then used where i needed mysql function and it was showing errors.now if xampp isnot launched game crashes at start but showing error in text file.
Code: Select all
init python:
def f():
import paramiko
-
- Regular
- Posts: 83
- Joined: Sat May 04, 2024 10:40 pm
- Contact:
Re: Any way to work with SFTP?
Put this in rpy
init python:
import paramiko
Def f():
Some code
Label something:
$ f()
This in rpy you need this function and where need
Call f in rpy. $ f()
Maybe evrything in one file.use import at the begining
init python:
import paramiko
Def f():
Some code
Label something:
$ f()
This in rpy you need this function and where need
Call f in rpy. $ f()
Maybe evrything in one file.use import at the begining
-
- Newbie
- Posts: 22
- Joined: Wed Jun 21, 2023 3:34 am
- Projects: Yandere pjSEKAI boys (Yandere Rui)
- Discord: nofanru
- Contact:
Re: Any way to work with SFTP?
The game crashes due to import paramiko. By writing this directly in init python it doesn’t even startgiorgi1111 wrote: ↑Sun May 26, 2024 11:35 am init python:
import paramiko
Def f():
Some code
Call f in rpy. $ f()
-
- Regular
- Posts: 83
- Joined: Sat May 04, 2024 10:40 pm
- Contact:
Re: Any way to work with SFTP?
That is same error at the begining or middle but import neednot to define in function.import paramiko and then use it to define function you need for something using paramiko functions.
-
- Regular
- Posts: 83
- Joined: Sat May 04, 2024 10:40 pm
- Contact:
Re: Any way to work with SFTP?
Example:
Init python:
import paramiko
Def something():
local_file_path = '<your_local_file_path>'
remote_file_path = '<your_remote_file_path>'
ssh_client = paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_client.connect( \
hostname = '<your_hostname>', \
username = 'busde',
key_filename = ssh_key_path
)
ftp_client = ssh_client.open_sftp()
ftp_client.put(local_file_path, remote_file_path)
ftp_client.close()
ssh_client.close()
Label something:
$ something()
Init python:
import paramiko
Def something():
local_file_path = '<your_local_file_path>'
remote_file_path = '<your_remote_file_path>'
ssh_client = paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_client.connect( \
hostname = '<your_hostname>', \
username = 'busde',
key_filename = ssh_key_path
)
ftp_client = ssh_client.open_sftp()
ftp_client.put(local_file_path, remote_file_path)
ftp_client.close()
ssh_client.close()
Label something:
$ something()
-
- Newbie
- Posts: 22
- Joined: Wed Jun 21, 2023 3:34 am
- Projects: Yandere pjSEKAI boys (Yandere Rui)
- Discord: nofanru
- Contact:
Re: Any way to work with SFTP?
I'm trying to do something like this, all my code is in a script:giorgi1111 wrote: ↑Sun May 26, 2024 11:59 am Example:
Init python:
import paramiko
Def something():
local_file_path = '<your_local_file_path>'
remote_file_path = '<your_remote_file_path>'
ssh_client = paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_client.connect( \
hostname = '<your_hostname>', \
username = 'busde',
key_filename = ssh_key_path
)
ftp_client = ssh_client.open_sftp()
ftp_client.put(local_file_path, remote_file_path)
ftp_client.close()
ssh_client.close()
Label something:
$ something()
Code: Select all
init python:
import paramiko
def f():
host = "<host>"
port = <port>
transport = paramiko.Transport((host, port))
transport.connect(username='<user>', password='<password>')
sftp = paramiko.SFTPClient.from_transport(transport)
remotepath = 'test.txt'
localpath = 'C:/Users/Admin/Desktop/test.txt'
sftp.get(remotepath, localpath)
sftp.put(localpath, remotepath)
sftp.close()
transport.close()
label start:
scene bg room
e "Blah blah blah"
$ f()
e "Blah?"
return
-
- Regular
- Posts: 83
- Joined: Sat May 04, 2024 10:40 pm
- Contact:
Re: Any way to work with SFTP?
I dont using sftp. If you know your code is good then it is module problem .try with other sftp module
-
- Regular
- Posts: 83
- Joined: Sat May 04, 2024 10:40 pm
- Contact:
Re: Any way to work with SFTP?
Now i see paramiko needs install .even if put all required modules yourself i dont think it works.
-
- Newbie
- Posts: 22
- Joined: Wed Jun 21, 2023 3:34 am
- Projects: Yandere pjSEKAI boys (Yandere Rui)
- Discord: nofanru
- Contact:
Re: Any way to work with SFTP?
I did a little searching on the Internet and, as I understand it, paramiko uses pyCrypto, which has a lot of C-extension modules. And from what I found on the Internet, if I understand correctly, to implement this library I need to build renpy from source?
If this is the case, then it is sad, this all seems out of my level of knowledge and I really don't want to deal with it...
Still hoping to find an easier way
If this is the case, then it is sad, this all seems out of my level of knowledge and I really don't want to deal with it...
Still hoping to find an easier way
Who is online
Users browsing this forum: Bing [Bot], Google [Bot], LemonaBittera, Ocelot, Semrush [Bot]