0

I' m new to Raspberry Pi and I created a file with the code:

from tkinter import *
from PIL import Image, ImageTk
import board
import busio
from adafruit_as726x import AS726x_I2C
import time
import RPi.GPIO as GPIO
from picamera import PiCamera
from time import sleep
from picamera.array import PiRGBArray
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import os
camera = PiCamera()
    
root=Tk()
root.wm_attributes('-fullscreen', 'true')
  
# setting the windows size 
root.geometry("800x480") 

PhWait = PhotoImage(file = "/home/pi/AdjustedGraphicsFiles/WaitScreen.png")
FrWait = Frame(root, width=800, height=480,bg="grey",highlightbackground="yellow")
FrWait.pack()
CanvWait = Canvas(FrWait, width=800, height=480)
CanvWait.pack()
CanvWait.create_image(0,0,anchor=NW, image=PhWait)

root.mainloop()

I gave "AllLibraries.py" as a name. It worked fine when I run it from Thonny. I want to run it with double click, so I made executable with the command:

$ pyinstaller AllLibraries.py

and then with the command:

$ pyinstaller --onefile AllLibraries.py

In both cases, the executable file could not run. Is there any answer? How can I run it? I suspect that the problem is in the libraries because when I made it executable removing all imports (exept the 1st one), it worked fine.

Can anyone help? Thanks in advance Nikolas Vardakis

2
  • 1
    does the file have the executable flag set? Commented Feb 25, 2021 at 18:08
  • No, What is flag set? What to do with flag set? Thanks Commented Feb 25, 2021 at 18:18

1 Answer 1

0

To make a file executable in Linux, the O/S needs to know it can be run from the command line by using a flag (permissions) that controls who has access.

You can show these with the ls -l command e.g.:

ls -l
total 28
drwxr-xr-x 2 pi pi 4096 Feb 17 21:28  bin
drwxr-xr-x 2 pi pi 4096 Aug 20  2020  Desktop
drwxr-xr-x 3 pi pi 4096 Dec 11 19:14  Documents
drwxr-xr-x 2 pi pi 4096 Jan  6 23:12  Downloads
drwxr-xr-x 2 pi pi 4096 Feb  8 16:42 'Old Code'
drwxr-xr-x 2 pi pi 4096 Feb 17 20:47  test
drwxr-xr-x 4 pi pi 4096 Feb  8 16:21  XIAOMI-Mijia

A good introduction to these permissions can be found on the linux.com site here

To check your program run

ls -l AllLibraries.py

and check if you have the 'x' for executable permission set. If not you use the chmod command:

chmod +x AllLibraries.py

You should them be able to run the program (assuming it's in your path) with AllLibraries.py Note the '.py' is required as its part of the command name and the command is case sensitive (so alllibraries.py will not work for example).

Some examples of the chmod command are here but there are plenty of sites available with your favourite search engine.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.