Coder Social home page Coder Social logo

docstamp's People

Contributors

alexsavio avatar ljsalvatierra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

hmajid2301 itrich

docstamp's Issues

Argument '--file_name_fields' not required

Traceback (most recent call last):
File "/home/ljsalvatierra/virtualenvs/docstamp/bin/docstamp", line 4, in
import('pkg_resources').run_script('docstamp==0.2.4', 'docstamp')
File "/home/ljsalvatierra/virtualenvs/docstamp/local/lib/python2.7/site-packages/pkg_resources/init.py", line 735, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/home/ljsalvatierra/virtualenvs/docstamp/local/lib/python2.7/site-packages/pkg_resources/init.py", line 1659, in run_script
exec(script_code, namespace, namespace)
File "/home/ljsalvatierra/virtualenvs/docstamp/local/lib/python2.7/site-packages/docstamp-0.2.4-py2.7.egg/EGG-INFO/scripts/docstamp", line 169, in

TypeError: object of type 'NoneType' has no len()


line 169: "if not len(file_name_fields):"

Relative paths

jinja2.exceptions.TemplateNotFound: docstamp/templates/badge_template_eco.svg


I've noticed you have to be in the template path, or it won't work.

Permission denied when writing tempfile on windows

It doesn't work out of the box because of the tempfile.NamedTemporaryFile used on file_utils returns an open file, not just the name, which can't be reopened.

Note

Closing the file returned by the function get_tempfile works because the handle is never used. Not pretty, but works.

(template.py/SVGDocument.render and template.py/LateXDocument.render)

Traceback:

C:\Users\Martin\1-CAREM\3-Caratulas Manuales>docstamp create -v -i data.csv -t caratula-tmpl_2.svg -d svg -o caratulas
DEBUG:docstamp.cli.cli:Reading CSV elements from C:\Users\Martin\1-CAREM\3-Caratulas Manuales\data.csv.
DEBUG:docstamp.cli.cli:Creating the template object using the file C:\Users\Martin\1-CAREM\3-Caratulas Manuales\caratula-tmpl_2.svg.
DEBUG:docstamp.cli.cli:Created an object of type <class 'docstamp.template.SVGDocument'>.
DEBUG:docstamp.cli.cli:Filling template 00 with values of item 0.
DEBUG:docstamp.cli.cli:Rendering file C:\Users\Martin\1-CAREM\3-Caratulas Manuales\caratulas\caratula-tmpl_2_00.svg.
C:\Users\Martin\AppData\Local\Temp\tmpsa4be55x.svg
ERROR:docstamp.file_utils:Error writing to file in C:\Users\Martin\AppData\Local\Temp\tmpsa4be55x.svg
Traceback (most recent call last):
  File "C:\Users\Martin\1-CAREM\3-Caratulas Manuales\python\python-3.7.0\lib\site-packages\docstamp\file_utils.py", line 192, in write_to_file
    with open(file_path, "wb") as f:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Martin\\AppData\\Local\\Temp\\tmpsa4be55x.svg'
ERROR:docstamp.template:Document of type <class 'docstamp.template.SVGDocument'> got an error when                    writing content.
Traceback (most recent call last):
  File "C:\Users\Martin\1-CAREM\3-Caratulas Manuales\python\python-3.7.0\lib\site-packages\docstamp\template.py", line 158, in save_content
    encoding=encoding)
  File "C:\Users\Martin\1-CAREM\3-Caratulas Manuales\python\python-3.7.0\lib\site-packages\docstamp\file_utils.py", line 192, in write_to_file
    with open(file_path, "wb") as f:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Martin\\AppData\\Local\\Temp\\tmpsa4be55x.svg'
ERROR:docstamp.cli.cli:Error creating C:\Users\Martin\1-CAREM\3-Caratulas Manuales\caratulas\caratula-tmpl_2_00.svg for {'numero': '1', 'zzBibliorato': '1', 'rack': 'IUS', 'tomo': 'Tomo único', 'copia': '1', 'Entrega': '
1', 'codigo': '100271', 'contenido': 'IUS-1001|IUS-1002|||||', 'contenido_1': 'IUS-1001', 'contenido_2': 'IUS-1002', 'contenido_3': '', 'contenido_4': '', 'contenido_5': '', 'contenido_6': '', 'contenido_7': '', 'columna
_inventariado': 'SCMP - Diagramas eléctricos y Layout IUS: Bibliorato 1 Copia 1 (Entrega 1) IUS Tomo único (IUS-1001)'}.
Traceback (most recent call last):
  File "C:\Users\Martin\1-CAREM\3-Caratulas Manuales\python\python-3.7.0\lib\site-packages\docstamp\template.py", line 158, in save_content
    encoding=encoding)
  File "C:\Users\Martin\1-CAREM\3-Caratulas Manuales\python\python-3.7.0\lib\site-packages\docstamp\file_utils.py", line 192, in write_to_file
    with open(file_path, "wb") as f:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Martin\\AppData\\Local\\Temp\\tmpsa4be55x.svg'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Martin\1-CAREM\3-Caratulas Manuales\python\python-3.7.0\lib\site-packages\docstamp\cli\cli.py", line 154, in create
    template_doc.render(file_path, **kwargs)
  File "C:\Users\Martin\1-CAREM\3-Caratulas Manuales\python\python-3.7.0\lib\site-packages\docstamp\template.py", line 248, in render
    self.save_content(temp.name)
  File "C:\Users\Martin\1-CAREM\3-Caratulas Manuales\python\python-3.7.0\lib\site-packages\docstamp\template.py", line 163, in save_content
    raise Exception(msg) from exc
Exception: Document of type <class 'docstamp.template.SVGDocument'> got an error when                    writing content.

AttributeError: 'list' object has no attribute 'replace'

ERROR:docstamp.cli.cli:Error filling document for 17th item
Traceback (most recent call last):
File "/opt/anaconda3/envs/acpyss/lib/python3.5/site-packages/docstamp/cli/cli.py", line 152, in create
template_doc.fill(item)
File "/opt/anaconda3/envs/acpyss/lib/python3.5/site-packages/docstamp/template.py", line 220, in fill
doc_contents[key] = replace_chars_for_svg_code(content)
File "/opt/anaconda3/envs/acpyss/lib/python3.5/site-packages/docstamp/svg_utils.py", line 26, in replace_chars_for_svg_code
result = result.replace(c, entity)
AttributeError: 'list' object has no attribute 'replace'
ERROR:docstamp.cli.cli:Error filling document for 21th item
Traceback (most recent call last):
File "/opt/anaconda3/envs/acpyss/lib/python3.5/site-packages/docstamp/cli/cli.py", line 152, in create
template_doc.fill(item)
File "/opt/anaconda3/envs/acpyss/lib/python3.5/site-packages/docstamp/template.py", line 220, in fill
doc_contents[key] = replace_chars_for_svg_code(content)
File "/opt/anaconda3/envs/acpyss/lib/python3.5/site-packages/docstamp/svg_utils.py", line 26, in replace_chars_for_svg_code
result = result.replace(c, entity)
AttributeError: 'list' object has no attribute 'replace'

Add the option to export PDFs to CMYK

Since badges need to be printed, most printing services ask for PDFs in CMYK color space. One way to convert a PDF to CMYK is with ghostscript:

gs -dSAFER -dBATCH \
    -dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite \
    -sColorConversionStrategy=CMYK \
    -dProcessColorModel=/DeviceCMYK \
    -sOutputFile=document_cmyk.pdf \
    document_rgb.pdf

Very weird error

ERROR:docstamp.template:Error saving <class 'docstamp.template.SVGDocument'> file in /tmp/tmpQKrhjs.svg
Traceback (most recent call last):
File "build/bdist.linux-x86_64/egg/docstamp/template.py", line 155, in save_content
f.write(self.file_content_)#.encode('utf8'))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfa' in position 9637: ordinal not in range(128)
ERROR:main:Error creating folder/plantilla_test_0.pdf for {u'a': u'a', u'c': u'c', u'b': u'b'}.
Traceback (most recent call last):
File "/home/ljsalvatierra/virtualenvs/docstamp/local/lib/python2.7/site-packages/docstamp-0.2.4-py2.7.egg/EGG-INFO/scripts/docstamp", line 245, in
File "build/bdist.linux-x86_64/egg/docstamp/template.py", line 213, in render
self.save_content(temp.name)
File "build/bdist.linux-x86_64/egg/docstamp/template.py", line 155, in save_content
f.write(self.file_content_)#.encode('utf8'))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfa' in position 9637: ordinal not in range(128)

render: 'file_type'

I get this error when I don't specified the '-c' option (command). I fixed it setting as default 'inkscape' in the argument parser.

TypeError: render() got an unexpected keyword argument 'file_type'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.