[scribus] Patch submitted for Command Line Arguments to be passed to python script

JLuc jluc at no-log.org
Sun Sep 13 08:02:42 UTC 2015


I've documented these features
http://wiki.scribus.net/canvas/Command_line_scripts

can you have a look and improve when usefull ?

Thanks

JL

Le 13/09/2015 03:29, William Bader a écrit :
>> To: scribus at lists.scribus.net
>> From: gpittman at iglou.com
>> Date: Sat, 12 Sep 2015 20:03:23 -0400
>> Subject: Re: [scribus] Patch submitted for Command Line Arguments to be passed to python script
>>
>> I wonder if someone could manage to write some documentation on how to
>> use this new capability.
>>
>> It seems that entering -someargv value1 as parameters is not very
>> helpful instructions.
>>
>> What is it that the script is expecting?
>>
>> Do scripts have to have this 'def main(argv)' structure in order to work?
>>
>> Not all of us are using this routinely. Python certainly doesn't require it.
>>
>> Greg
> I posted a small example a while ago at http://bugs.scribus.net/view.php?id=13311#c36071 (the python script is attached to the mantis page).
> Berteh's patch lets you pass arbitrary flags and arguments to the python script.
> For example, my example script inserts text into a text frame in an SLA file.
> Instead of hard-coding the name of the text file in the script, you can pass it on the command line with "scribus -g -py storydeptharg.py --python-arg -storyfile sample.txt depthtemplate.sla" (I'm not sure about the final syntax that they settled on.)
> The python script the sees an argv that contains "-storyfile" and "sample.txt".
> The command line options are very useful for anyone who is trying to script Scribus from another program, perhaps to create documents or to export documents to PDF.
> Without the command line patch, you have to hard-code the file names or you have to generate a customized script each time or you have to pass arguments through environment variables.
> I think that the command line comes from sys.argv, so you might be able to use "def main():" and then look at sys.argv.
> My example has
> def main(argv):
>    ...
> if __name__ == '__main__':
>    main(sys.argv)
>
> Regards,
> William Bader, Director of Research and Development, SCS, http://www.newspapersystems.com
>   		 	   		
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.scribus.net/pipermail/scribus/attachments/20150912/cba5d64e/attachment.html>
> ___
> Scribus Mailing List: scribus at lists.scribus.net
> Edit your options or unsubscribe:
> http://lists.scribus.net/mailman/listinfo/scribus
> See also:
> http://wiki.scribus.net
> http://forums.scribus.net
>





More information about the scribus mailing list