Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Inline::Python for windows 10

by tobbes (Acolyte)
on Oct 17, 2018 at 11:29 UTC ( #1224152=note: print w/replies, xml ) Need Help??


in reply to Inline::Python for windows 10

I just realized that I do not know how well Inline::Python would work for me even if I got it installed. I need to distribute my script as a .exe file and I am somewhat dubious as to whether the pythonfiles will be included in the .exe magically. Lilkely the users will have to install Python, which is not an option. It basically leaves me with one option as far as i understand: run perl and python as seperate processes and then use sockets to communicate between them *sigh* that should be simple and stable.

Replies are listed 'Best First'.
Re^2: Inline::Python for windows 10
by swl (Deacon) on Oct 17, 2018 at 20:57 UTC

    Is there a python equivalent of PAR::Packer? If so then you could embed your packed python exe with the packed perl exe. e.g., something like:

    pp --addfile packed_python.exe -o yourtool.exe yourtool.pl

    In your perl script you would need to find the packed python exe and call it, e.g.:

    $python_exe = Path::Class::file ($ENV{PAR_TEMP}, 'inc', 'packed_python.exe');

    Your perl script will need to check for $ENV{PAR_0} to control the use of a packed python exe, otherwise debugging can be a pain, but this can be factored into a sub and the general approach does work.

    Addendum - unsurprisingly, there are tools to pack python exes. I have no idea if these work, but this link looks handy at first glance: https://medium.com/dreamcatcher-its-blog/making-an-stand-alone-executable-from-a-python-script-using-pyinstaller-d1df9170e263

      at some point you need to ignore "packers" and just distribute a big'ol zip file

        That's certainly an option, and in some cases would be simpler. That said, most packers generate a zip file in any case. The fact that it is self-extracting means it can be run by double clicking, which is easier for many end-users.

Re^2: Inline::Python for windows 10
by marto (Archbishop) on Oct 17, 2018 at 17:19 UTC

    You can't rewrite your python in perl, or vice versa?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1224152]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (9)
As of 2019-10-23 13:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?