Hi Amanda,

It seems you want to use the feature of pyconcrete.  I haven't used that package myself but from the documentation, it would seem like .pye files are looked in the Python path.  My guess would be to import them, not as hidden modules (it won't work, hidden modules only are for Python modules, .py files, if I'm not mistaken), but as data files.  You then need to extend sys.path to let it know where to find your PYE files.

I might be mistaken, someone will correct if I'm wrong, but I believe, when you freeze a Python script with PyInstaller, the generated Python script has a limited sys.path which doesn't include the current working directory, contrary to what happens in a non-frozen Python environment.  I tend to add a line like this at the top of my main project file, to ensure the Python path contains the current working directory, even when frozen:

from pathlib import Path
import sys
sys.path.append(str(Path().absolute()))
Obviously, you'll need to do that in your main script and before you import your PyE file.  And your .pye file will need to be in the "current working directory" when you execute your frozen script.  So you'll also need to add it as a data file.

You don't have to put it in the root directory either.  It can be messy.  You can place it in a sub-directory.  That's your choice. Just remember to edit your .spec file accordingly, and your main script to extend the Python path.

HTH,

Vincent

On 9/2/2020 8:45 AM, Amanda Beuno wrote:
Good day,

I searched the group on how to import pye files but I couldn`t find any topics on that matter. Apologies if I missed it.

I have a pye file in my project that I need to import in my project and I tried adding it using "--hidden-import", but I always get "missing module named pyeModule".

I also tried adding that pye file to the PYTHONPATH but to no avail.

Any pointers would be appreciated!

Amanda
--
You received this message because you are subscribed to the Google Groups "PyInstaller" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/f77233e4-fc99-4bf2-9f86-67f5e36468f9n%40googlegroups.com <https://groups.google.com/d/msgid/pyinstaller/f77233e4-fc99-4bf2-9f86-67f5e36468f9n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyinstaller/14eb700d-da1e-86dc-ff35-ce85aafaafbb%40gmail.com.

Reply via email to