Pyinstaller --add-data Problem for directories | Sololearn: Learn to code for FREE!

0

Pyinstaller --add-data Problem for directories

I tried out to add files to a single executable. I did manage to get it working but now I have the problem, that when I add Folders, The code kind of sees that the data is there, but if I want to set variables with functions etc. It can't find the file or/and the directory.

9/11/2021 2:54:23 PM

Alpha-Craft

4 Answers

New Answer

0

I found the problem and solved it. Now I also know that the files added are static and if I try to change them they will be resettled next time. At least I think so. It has problems with images. That's all. That's why it couldn't import my images into the code. Anyway. Thank you!

0

Alpha you need to explain a little more, maybe even bpaste your code so we can try to recreate your issue. Can you explain what you mean by ‘The code kind of sees’? It’s either including the files or not. It may just be flattening the sub dirs. Can you provide your full build command, as are you adding the directory path? If so you need to remember an asterix on the end of the path “var/files/*;var/files2/*;”

0

The code is able to find the path, when I try to use the specially defined method for getting the path. It does display it but if I try to access the file and use it the code tells that there is no such file or directory. Right now I am not able to give any further examples.

0

You’ll atleast have to give me something I can replicate....else it’s not going to be much help. At the least can you tell me the file extension. I’ll try and create an exe with a long path and then same type of file/data. As I don’t see how it can find the path, then tell you there is no such directory...Unless your not stepping on and physically checking the path?