# Import BrotherPrint python scrip to print on Brother Printer Label Makers

**URL:** <https://forum.inductiveautomation.com/t/import-brotherprint-python-scrip-to-print-on-brother-printer-label-makers/17908>\
**Category:** Ignition\
**Tags:** python, scripting\
**Created:** [May 2, 2018, 9:15pm UTC](https://forum.inductiveautomation.com/t/import-brotherprint-python-scrip-to-print-on-brother-printer-label-makers/17908 "2018-05-02T21:15:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![scott.jenkins](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@scott.jenkins](https://forum.inductiveautomation.com/u/scott.jenkins)\
**Post date:** [May 2, 2018, 9:15pm UTC](https://forum.inductiveautomation.com/t/import-brotherprint-python-scrip-to-print-on-brother-printer-label-makers/17908/1 "2018-05-02T21:15:48Z")

</div>

I am trying to print to a brother printer and have been able to easily do it using python, but get the following error when I try to import the brotherprint python library:

Traceback (most recent call last):  
File “”, line 1, in   
File “C:\Users\Scott Jenkins.ignition\cache\gwlocalhost\_8088\_8043\_main\C0\pylib\brotherprint.py”, line 137  
cut\_settings = {‘full’ : 0b00000001, ‘half’ : 0b00000010, ‘chain’: 0b00000100, ‘special’: 0b00001000}  
^  
SyntaxError: no viable alternative at input ‘b00000001’

The brother print library can be found at: [https://test.pypi.org/project/brotherprint/0.1.3/](https://test.pypi.org/project/brotherprint/0.1.3/)

Any help would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 2, 2018, 9:22pm UTC](https://forum.inductiveautomation.com/t/import-brotherprint-python-scrip-to-print-on-brother-printer-label-makers/17908/2 "2018-05-02T21:22:33Z")

</div>

It looks like this library requires _at least_ Python 2.6 (binary literals are from 2.6).

Ignition’s Python implementation is currently based on 2.5. You’ll have to either port that library to 2.5 yourself or find another one.

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [May 3, 2018, 9:18am UTC](https://forum.inductiveautomation.com/t/import-brotherprint-python-scrip-to-print-on-brother-printer-label-makers/17908/3 "2018-05-03T09:18:06Z")

</div>

See [https://stackoverflow.com/questions/1476/how-do-you-express-binary-literals-in-python](https://stackoverflow.com/questions/1476/how-do-you-express-binary-literals-in-python)

Basically, you’ll have to start with replacing all occurences of `0b000100` and alike to `int("000100", 2)`, as the used syntax is new for Python 2.6.

You may bump into additional problems, but I guess 2.5 and 2.6 should still be rather compatible.

---

<div class="post-metadata">

**Author:** ![scott.jenkins](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@scott.jenkins](https://forum.inductiveautomation.com/u/scott.jenkins)\
**Post date:** [May 16, 2018, 12:50pm UTC](https://forum.inductiveautomation.com/t/import-brotherprint-python-scrip-to-print-on-brother-printer-label-makers/17908/4 "2018-05-16T12:50:48Z")

</div>

Thanks guys - after replacing the syntax on the binary definitions everything worked fine and I was able to send print commands to the label printer

---

<div class="post-metadata">

**Author:** ![marianjel\_11](https://avatars.discourse-cdn.com/v4/letter/m/3ec8ea/32.png) [@marianjel\_11](https://forum.inductiveautomation.com/u/marianjel_11)\
**Post date:** [October 22, 2019, 3:57pm UTC](https://forum.inductiveautomation.com/t/import-brotherprint-python-scrip-to-print-on-brother-printer-label-makers/17908/5 "2019-10-22T15:57:17Z")

</div>

Hi, I’m printing on a brother printer too, I plan to use the library you used, could you help me or give an example of how you did it? I am starting with this type of application!
