Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using txt2tags as a module is broken #111

Closed
GoogleCodeExporter opened this issue Apr 18, 2015 · 1 comment
Closed

Using txt2tags as a module is broken #111

GoogleCodeExporter opened this issue Apr 18, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

This is the ability - given a copy of txt2tags in the PYTHONPATH with a .py 
extension - to, from within a Python script, import txt2tags as a module and 
pass a list of strings (each one corresponding to a line) and to receive as a 
return value a similar list representing the output file. There seems to have 
already been some work done working towards this, but (at least as far as I can 
tell) it isn't quite there yet.
This was quite simple for me to fix - there were two functions, 
"process_source_file" and "convert_this_files", which accepted an optional 
parameter specifying the contents of a file. This parameter simply wasn't 
passed in by the "exec_command_line" and "get_infiles_config" functions. 
Though this patch did pass the tests to the same degree as r643 does (flying 
colors except the sample module complains about the aap target and the art 
module complains about the aat target) and it does work with one "virtual" 
file, I would be very uncertain about attempting to use multiple such files.
Also, to avoid the Python misfeature of mutable default arguments of a function 
not being emptied with multiple calls to said function, both default arguments 
to "exec_command_line" are now tuples instead of lists, though they are 
immediately converted to lists.

Original issue reported on code.google.com by joker...@bellsouth.net on 29 Dec 2010 at 6:01

Attachments:

@jendrikseipp
Copy link

I believe what the original reporter was trying to accomplish is now possible in txt2tags. The code under samples/module/ shows how to do it. One of the two files is currently broken. I'll try to fix this.

@jendrikseipp jendrikseipp self-assigned this Aug 5, 2015
@jendrikseipp jendrikseipp added this to the v2.7 milestone Aug 5, 2015
@jendrikseipp jendrikseipp changed the title Module I/O (passing/returning lists instead of filenames) Using txt2tags as a module is broken Aug 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants