kivy python 读取oracle数据库,从内部存储Kivy Python加载图像

I am looking for a solution regarding loading images from internal storage file manager via my kivy application.

for testing,i need to select the image from internal storage and then convert it into gray scale image by using opencv.

I have tried filechooserlistview,but however i could not access my internal storage.

I have also added below mentioned line in my buildozer.spec file.

android.permissions = READ_EXTERNAL_STORAGE,WRITE_EXTERNAL_STORAGE

i'm searching for this solution for the last two days but i didn't get any proper result yet.

Please share the code if anything you have.

Thanks in advance

解决方案

In newer Android systems, the buildozer permission request for accessing the storage is not working with kivy.

To acquire these permissions you have to ask for them in your app by:

from android.permissions import request_permissions, Permission

request_permissions([Permission.WRITE_EXTERNAL_STORAGE,

Permission.READ_EXTERNAL_STORAGE])

... and the user will be asked to your App to access the storage.

The android library is included in the buildozer builds, so that request is all you have to do...

To get the internal storage path:

from android.storage import primary_external_storage_path

SD_CARD = primary_external_storage_path()

Note that this is the virtual (internal) SD card of the system.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Python中,我们可以使用第三方库cx_Oracle读取Oracle数据库。首先,需要安装cx_Oracle库,并确保已经设置好了Oracle客户端。接下来,可以按照以下步骤读取Oracle数据库: 1. 首先,导入必要的库: ```python import cx_Oracle ``` 2. 使用cx_Oracle.connect()函数连接到Oracle数据库,需要提供数据库的用户名、密码和连接字符串: ```python connection = cx_Oracle.connect('username', 'password', 'connection_string') ``` 请将'username'替换为您的Oracle数据库用户名,'password'替换为您的密码,'connection_string'替换为正确的连接字符串。 3. 创建一个游标对象,用于执行SQL查询: ```python cursor = connection.cursor() ``` 4. 使用cursor.execute()方法执行您的SQL查询。例如,如果您要查询名为"employees"的表中的所有记录,可以执行以下代码: ```python cursor.execute('SELECT * FROM employees') ``` 5. 使用cursor.fetchall()方法获取查询结果。例如,如果您想将查询结果存储在一个变量中: ```python results = cursor.fetchall() ``` 现在,您可以使用results变量来处理查询结果。 6. 最后,不要忘记关闭游标和数据库连接: ```python cursor.close() connection.close() ``` 这样就完成了从Oracle数据库读取数据的过程。请确保您已经按照上述步骤正确安装和配置了cx_Oracle库,并提供了正确的数据库连接信息。<span class="em">1</span><span class="em">2</span> #### 引用[.reference_title] - *1* [PythonOracle数据库中获取数据——fetchall(),fetchone(),fetchmany()函数功能分析](https://blog.csdn.net/qq_28268527/article/details/128629153)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [使用Python代码调用命令行来执行MySQL数据库备份和恢复操作](https://download.csdn.net/download/weixin_44609920/88222336)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值