Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20944 > unrolled thread
| Started by | Andrea Crotti <andrea.crotti.0@gmail.com> |
|---|---|
| First post | 2012-02-27 15:05 +0000 |
| Last post | 2012-02-27 15:05 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: windows executable calling python script Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-02-27 15:05 +0000
| From | Andrea Crotti <andrea.crotti.0@gmail.com> |
|---|---|
| Date | 2012-02-27 15:05 +0000 |
| Subject | Re: windows executable calling python script |
| Message-ID | <mailman.202.1330355127.3037.python-list@python.org> |
On 02/27/2012 02:21 PM, Andrea Crotti wrote:
>
> At the moment I ended up with something like this:
>
> #include <stdarg.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
>
>
> // the function takes as arguments only the python interpreter full path
> int main(int argc, char *argv[])
> {
> if (argc < 2) {
> fprintf(stderr, "Usage = ./run <python_executable_path>");
> exit(1);
> }
> /* TODO: make the path absolute? is it necessary? */
> char *const to_run[1] = {"run.py"};
> /* TODO: check if the path exists or not, and if it's executable */
>
> execv(argv[1], to_run);
> return 1;
> }
>
> which still doesn't work (I have to fix the execv) but when it will in
> theory I will only need
> to tell NSIS to create a link to that executable passing as argument
> the right python executable.
> After that it will run the run.py with in the local directory..
>
> Easier ways (without py2exe and similars?)?
For the record I think I found a solution, now the wrapper works:
int main(int argc, char *argv[])
{
if (argc < 2) {
fprintf(stderr, "Usage = ./run <python_executable_path>");
exit(1);
}
/* TODO: make the path absolute? is it necessary? */
char *const to_run[] = {"python", RUNNER, (char *) 0};
execv(argv[1], to_run);
return 1;
}
and I only need to tell NSIS to create a shortcut passing as argument
the path to the python executable,
nice and simple..
Back to top | Article view | comp.lang.python
csiph-web