Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to use pysmb with kivy on android platform? #225

Open
thmsts88 opened this issue Feb 14, 2025 · 4 comments
Open

Is it possible to use pysmb with kivy on android platform? #225

thmsts88 opened this issue Feb 14, 2025 · 4 comments

Comments

@thmsts88
Copy link

thmsts88 commented Feb 14, 2025

Hi,
I've been trying to build a android app that connect to a Samba Server and copy into it some files.
Using kivy and buildzer I've been able build the app that succesfully locate all wanted files (using os), and it works fine.
However, as soon as I add reference to pysmb app stop working (as it was missing android permissions)

buildozer.spec
# (list) Application requirements
requirements = python3,kivy,android,pysmb

# (list) Permissions
android.permissions = android.permission.INTERNET, android.permission.WRITE_EXTERNAL_STORAGE, android.permission.READ_EXTERNAL_STORAGE, android.permission.MANAGE_EXTERNAL_STORAGE

main.py
from smb.SMBConnection import SMBConnection
def on_button3_press(self, instance):
try:
conn = SMBConnection(self.username_input.text, self.password_input.text, use_ntlm_v2=True)
conn.connect(self.server_input.text, 139)
self.status_label.text = 'Connected!'
except Exception as e:
self.status_label.text = f'Error: {str(e)}'

I've also made the recipe for buildozer
from pythonforandroid.recipe import PythonRecipe
class PySMBRecipe(PythonRecipe):
version = '1.2.10'
url = 'https://files.pythonhosted.org/packages/source/p/pysmb/pysmb-{version}.tar.gz'
depends = ['python3', 'pyasn1', 'tqdm']
site_packages_name = 'pysmb'
recipe = PySMBRecipe()

Is there any known issues when pysmb is used with kivy on android?

Thanks for the support

@miketeo
Copy link
Owner

miketeo commented Feb 14, 2025

@thmsts88
Hi, I have not used kivy but I do have some experience with app development on Android. May I know if there's any error being written to logs or debugging console when your app stops working?

@thmsts88
Copy link
Author

Not that I'm aware of.
Do you have something specific in mind that I should check?

Anyway, just for sake of completion the app opens and closes right away. I had similar behavior when permissions weren't set.

@miketeo
Copy link
Owner

miketeo commented Feb 15, 2025

Without the error/crash logs, it will be a challenge to pinpoint what cause the app to crash.

It might be due to an import issue. Can you write a short code snippet to just import smb.ntlm? This sub-module will fail if the 3rd-party dependencies are not installed correctly on the device.

Another option is to copy python3/smb and python3/nmb folders to your app, and ignore pysmb folder structure. The presence of both python2 and python3 folders may confuse the builder, and cause the built app to have problems.

@thmsts88
Copy link
Author

Thanks for the heads up. I'll try the snippet.

As soon as I try I'll report back.

Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants