简体   繁体   English

如何在Linux(树莓派4)的屏幕上打开文本文件

[英]How to open text file on the screen of Linux (raspberry pi 4)

I try to open the text file on the linux os screen using python 3 but keep receive permission denied.我尝试使用 python 3 在 linux 操作系统屏幕上打开文本文件,但拒绝接收权限。

How could i open the text file using python3 on linux os (raspberry pi os ) and view file as full screen?我如何在 linux 操作系统(树莓派操作系统)上使用 python3 打开文本文件并全屏查看文件?

Note: I try both popen and os.system both being permission denied.注意:我尝试 popen 和 os.system 都被拒绝权限。

Here is my code:这是我的代码:

import os
from subprocess import Popen            
            
file_name = 'logfile_month_1_year_2023.txt'
file_path = '/home/csiro/Desktop/final_dobot_package/pydobot/logfile/'
file_open = os.path.join (file_path , file_name)
#os.system(r"/home/csiro/Desktop/final_dobot_package/pydobot/logfile/" + file)
Popen(file_open)

Permission denied could be a permission issue of the file that you are trying to open.权限被拒绝可能是您尝试打开的文件的权限问题。 Try hitting ls -l in the linux terminal first to see whether the particular user that you are using has read access.首先尝试在 linux 终端中点击ls -l以查看您使用的特定用户是否具有读取权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM