-2

The last few days, I created a site, using wix, to use as a portfolio. I left all my projects there. My sister, helping me try It, downloaded one of them, but she could not open it

The first problem was solved pretty fast. My computer uses linux, and her's uses Windows, so I just had to use a windows computer to run pyinstaller on my project. It worked

Now, I managed to create the windows executable. I tested on my windows computer, and it worked. However, my computer HAS python, while her's dont. I think the error might be my venv (virtual environment). Maybe the python interpreter she is supposed to use to run the program is in the wrong directory?

Image of what you get, after downloading my project "FastGrid":

FastGrid Directoryhttps://i.stack.imgur.com/PS77Y.png

(sorry for using external images, It's the only way I can make a good description the situation)

The only difference between her directory and mine is that her python files have a notepad icon. However, the extension is ".py", so I don't see how that is a problem. Unless somehow her pc is opening that with notepad, without using the python interpreter, and not executing the code properly.

Also, when I tried on my computer, my antivirus thought the file was a virus, and said It would take 80 minutos to verify It. I trusted the file and tried to open It, only to get a "You might not have permission to open the file" error. I refreshed the directory and It opened sucessfullt. The same happened to my sister (without the opening part, of course). She had this error, but later, when I tried again, It simply didn't run. No errors.

Again, I think the directory "venv" may be in the wrong spot, and that's why she can't open the executable, since the project may not be able to read the files. But, if that's the case, I don't know how I should modify that.

Also, here is my site, if you think that can be helpful. You can find my projects in the "blog" part https://lvalencacomputacao.wixsite.com/website

Thanks in advance. If I wasn't clear, please, feel free to ask your doubts on comments. I'll do my best to make the post better

Edit: The image is the project for windows, but opened in ubuntu, that's why there is a ".exe" there.

lvalenca
  • 51
  • 6
  • 1
    Can you clarify the actual problem you have ? It is not clear if it an issue with pyinstaller or python script. Please indicate the action you are doing and the detail result (error message if any) – Eric Mathieu Jul 16 '20 at 15:45
  • I see. It's a problem with the script. Pyinstaller sucessfully makes an executable, and the executable works in my computer. I'm clicking the executable (main.exe) in other computer and the program simply doesn't run. My guess is that the venv directory is in the wrong spot (see image for details) – lvalenca Jul 16 '20 at 16:10
  • 1
    If you use —onefile then the exe contains everything it requires to run. Is the script accessing external data files (image, text file) ? – Eric Mathieu Jul 16 '20 at 16:14
  • sorry for the delay. Yes, It is. It is acessing an image directory and a music directory, that's why I put it in the main directory, so It can acess all It needs. Also, thanks for helping :) – lvalenca Jul 16 '20 at 16:23
  • oh, and, as stated, my computer sucessfully runs the program. "main.py" is acessing everything it has to – lvalenca Jul 16 '20 at 16:24
  • OK. If I understand correctly you have an .exe built from main.py that runs perfectly well on your Windows PC. This exe requires data that are in subdirectories. You copy the .exe and the subdirectories to another Windows PC it is not working. Correct ? Please provide a MRE (Minimum Reproductible Example) from your source .py so that the community can help – Eric Mathieu Jul 16 '20 at 16:35
  • Yes, that's It. My sister downloaded the files from my site, which is on the post. So, essentially, the same as copying. Also, I don't quite understand. Did you mean the source code? I can provide it here, but If the community is going to reproduce the error, It should be way easier to just download It from the site, since It's already organizated there. – lvalenca Jul 16 '20 at 16:42
  • oh, I just googled the term "MRE". Maybe I can make a few alterations in the source code, so you don't need to download the music, making It ligher to reproduce. Sorry, I can't be sure, as my sister is working right now, so I can't test it on her pc – lvalenca Jul 16 '20 at 16:45
  • I tried to replicate the error by uninstalling python3 in my windows pc. The program still works, though, so I think venv is fine. I'm going to use my mother's computer now. Hopefully, the error may be on my sister's computer, and not the program itself – lvalenca Jul 16 '20 at 17:54
  • regarding the exe discussing venv is irrelevant. – Eric Mathieu Jul 16 '20 at 17:56
  • I am feeling that you are confused between the exe version and the script version of your application. Also run your exe from a cmd window so that you may see errors – Eric Mathieu Jul 16 '20 at 17:57
  • you may be right. I'm not familiar with the term "script version". Do you mean the one you execute in your IDE? – lvalenca Jul 16 '20 at 17:59
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/217983/discussion-between-eric-mathieu-and-lvalenca). – Eric Mathieu Jul 16 '20 at 18:00

2 Answers2

0

does all of your computer have python, it could probably beacuse you are using a virtual enviorment, and need to activate it before entering the the exe. the command : .\venv\Scripts\activate to activate te asets in your python project, what was the difrent from your sister computer and all of the computer, i could help you

-1

Everyone, the problem is solved. My sister's pc is probably the one at fault, here, since the program worked in every computer I tried besides her's.

Thanks

lvalenca
  • 51
  • 6