I'm trying to run a python flet script on repl.it. Here's what I did:
created a new repl, for a python script; repl.it creates a main.py file
from the Packages tool I imported flet
I wrote this code into main.py:
import flet as ft
def main(page:ft.Page):
page.add(ft.Text("Hello World"))
page.update()
ft.app(target=main)
And I clicked the Run button. I got this error:
Traceback (most recent call last):
File "main.py", line 8, in <module>
ft.app(target=main)
File "/home/runner/test/venv/lib/python3.10/site-packages/flet/flet.py", line 102, in app
conn = _connect_internal(
File "/home/runner/test/venv/lib/python3.10/site-packages/flet/flet.py", line 192, in _connect_internal
port = _start_flet_server(
File "/home/runner/test/venv/lib/python3.10/site-packages/flet/flet.py", line 361, in _start_flet_server
subprocess.Popen(
File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/subprocess.py", line 971, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/subprocess.py", line 1847, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: '/home/runner/test/venv/lib/python3.10/site-packages/flet/bin/fletd'
I've gotten this same Permission denied error with every flet script I've tried. (Non flet scripts don't have errors.)
Related
I've been tying to solve this issue but had no luck so far:
I have a script that captures some WIFI statistics from a raspberry pi.
the script runs fine when I execute from the terminal when using python network_test.py
script fails when I schedule a cron job using another python script:
python script to schedule job
from crontab import CronTab
cron = CronTab(user=True)
job = cron.new(command='cd /home/pi4/Documents/WIFI_Scan && /usr/bin/python /home/pi4/Documents/WIFI_Scan/network_test.py >> /home/pi4/Documents/WIFI_Scan/out.txt 2>&1')
job.minute.every(1)
for job in cron:
print(job)
cron.write()
- the script runs but i get the error below when I look at the out.txt file:
Traceback (most recent call last):
File "/home/pi4/Documents/WIFI_Scan/network_test.py", line 57, in <module>
print(subprocess.check_output(['iwgetid']).decode())
File "/home/pi4/Documents/WIFI_Scan/subprocess.py", line 424, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/home/pi4/Documents/WIFI_Scan/subprocess.py", line 505, in run
with Popen(*popenargs, **kwargs) as process:
File "/home/pi4/Documents/WIFI_Scan/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/home/pi4/Documents/WIFI_Scan/subprocess.py", line 1823, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'iwgetid'
here is the network_test.py script
import subprocess
output = subprocess.check_output(['iwgetid']).decode()
print(output)
I've tried many things but no luck..
Tried moving the script to the main python folder.
tried using a bash file to start the script from cron but nothing
I've a raspberry PI whit raspbian. When i try to start a python application whit selenium it give me some errors.
This is the application:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
browser = webdriver.Firefox(executable_path=r'/home/pi/Desktop/geckodriver')
This is errors:
Traceback (most recent call last):
File "uno.py", line 5, in <module>
browser = webdriver.Firefox(executable_path=r'/home/pi/Desktop/geckodriver')
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/firefox/webdriver.py", line 160, in __init__
self.service.start()
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python3.5/subprocess.py", line 676, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1282, in _execute_child
raise child_exception_type(errno_num, err_msg)
OSError: [Errno 8] Exec format error
How can i fix?
An exec error indicates you took the wrong OS file for geckodriver. See the below for all release
https://github.com/mozilla/geckodriver/releases
As of today (27th Jun 2018), you should probably be picking below
https://github.com/mozilla/geckodriver/releases/download/v0.21.0/geckodriver-v0.21.0-arm7hf.tar.gz
Also make sure to do
chmod +x /home/pi/Desktop/geckodriver
So that it has executable rights
I'm running a python script that exports xml from a database, converts the record to PDF, then attempts to upload both the xml and pdf files to a github repository. The export and pdf conversion work fine, but the process then hangs and outputs the following error message:
Traceback (most recent call last):
File "asExportIncremental.py", line 394, in <module>
main()
File "asExportIncremental.py", line 320, in main
gitPush()
File "asExportIncremental.py", line 308, in gitPush
repo.push()
File "C:\Python27\lib\site-packages\gittle\gittle.py", line 343, in push
return self.push_to(origin_uri, branch_name, progress)
File "C:\Python27\lib\site-packages\gittle\gittle.py", line 338, in push_to
progress=progress
File "C:\Python27\lib\site-packages\dulwich\client.py", line 440, in send_pack
proto, unused_can_read = self._connect('receive-pack', path)
File "C:\Python27\lib\site-packages\dulwich\client.py", line 893, in _connect
port=self.port, username=self.username)
File "C:\Python27\lib\site-packages\dulwich\client.py", line 758, in run_command
stdout=subprocess.PIPE)
File "C:\Python27\lib\subprocess.py", line 390, in __init__
errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 640, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
My problem is that I'm not exactly sure where the script is failing. To which file is "WindowsError: [Error 2] The system cannot find the file specified" referring? How do I fix it? Thanks!
The script calls gittle (high-level python git library) which executes dulwich (low-level python git wrapper) which runs ssh and fails. It seems ssh.exe is not in your PATH.
Under MacOSX Sierra, and XQuartz 2.7.11, Python 2.7. I was able to install dryscrape and its required other python packages. I've tried quite a few methods to get some simple code working, but I can't seem to get it working. Here is the simple code:
#!/usr/bin/python
#coding: utf-8
import dryscrape
testurl = 'http://avi.im/stuff/js-or-no-js.html'
dryscrape.start_xvfb()
session = dryscrape.Session()
session.visit(testurl)
exit()
You can see it is a simple python script file. It fails on either the start_svfb() or the Session() line. I can post the errors and such, but can I start a discussion on simply what check list should I setup, run, and test to make sure the X11 environment is right? Do I run the script under OS X terminal or XQuartz? What am I missing? etc.?
Thanks in advance, Lucas.
here is the last traceback from python:
Traceback (most recent call last):
File "./fred.py", line 19, in
session = dryscrape.Session()
File "build/bdist.macosx-10.12-intel/egg/dryscrape/session.py", line 22, in __init__
File "build/bdist.macosx-10.12-intel/egg/dryscrape/driver/webkit.py", line 30, in __init__
File "/Library/Python/2.7/site-packages/webkit_server-1.0-py2.7.egg/webkit_server.py", line 230, in __init__
self.conn = connection or ServerConnection()
File "/Library/Python/2.7/site-packages/webkit_server-1.0-py2.7.egg/webkit_server.py", line 507, in __init__
self._sock = (server or get_default_server()).connect()
File "/Library/Python/2.7/site-packages/webkit_server-1.0-py2.7.egg/webkit_server.py", line 450, in get_default_server
_default_server = Server()
File "/Library/Python/2.7/site-packages/webkit_server-1.0-py2.7.egg/webkit_server.py", line 416, in __init__
stderr = subprocess.PIPE)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
I am simply testing how to call external .py files from one .py file.
I have 2 .py files, both in the same directory. Here is the code for the main one (runext.py suppose to call ext.py):
import subprocess
subprocess.call("/Users/training/PycharmProjects/MarcouFirstProject/ext.py")
ext.py is just print("hey this actually worked")
However, every time I run runext.py, I get this error message:
Traceback (most recent call last):
File "/Users/training/PycharmProjects/MarcouFirstProject/runext.py", line 2, in <module>
subprocess.call("/Users/training/PycharmProjects/MarcouFirstProject/ext.py")
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 557, in call
with Popen(*popenargs, **kwargs) as p:
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
PermissionError: [Errno 13] Permission denied
I don't know why it denies permission. This is on a school computer (I'm in a programming class) if that helps.
Thanks.
You don't have the permissions to execute the file /Users/training/PycharmProjects/MarcouFirstProject/ext.py
You can add the permission +x by using chmod:
chmod +x /Users/training/PycharmProjects/MarcouFirstProject/ext.py
Or, you can use python explicitly:
import subprocess
subprocess.call("python /Users/training/PycharmProjects/MarcouFirstProject/ext.py")