Help needed on X12 grammars

135 views
Skip to first unread message

billsmit...@gmail.com

unread,
Apr 26, 2015, 12:03:38 PM4/26/15
to bots...@googlegroups.com
Hello,
I am a newbie to Python, so please pardon me if this is a very basic thing.

I have downloaded the grammar X12_004010_all_transactions_and_segments.zip from the website. The Wiki does not really tell me what I should do with this file.

I configured a parse & pass-through route, with an inbound file channel and outbound file channel. 

I have extracted the grammar zip file into C:\Python27\Lib\site-packages\bots\usersys\grammars\x12\x12

And in my route configuration, I have both Fromeditype and edimessagetype selected as x12. I tried moving the grammer file to different sub directorie too. But whenever I run the engine, I am getting the below error.
Should I be importing the grammar file through some command line utility? It will be helpful if the Wiki explains what to do after downloading the grammar files.

MessageError: Error in import of module "C:\Python27\lib\site-packages\bots\usersys\grammars\x12\x12": name 'X12_004010_all_transactions_and_segments' is not defined

henk-jan ebbers

unread,
Apr 26, 2015, 12:17:48 PM4/26/15
to bots...@googlegroups.com
if you need eg 850004010 translations, copy the file 850004010.py to bots/usersys/grammars/x12
probably you will also need the file records004010 from the zip-file, as this is 'imported' by the file 850004010.py

please check the plugins for translation x121 files & study those.
these contains good & realistic examples of how x12 is setup in terms of grammars.

kind regards,
henk-jan ebbers
> --
> You received this message because you are subscribed to the Google Groups "Bots Open Source EDI Translator" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to botsmail+u...@googlegroups.com <mailto:botsmail+u...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Kurohai

unread,
Apr 27, 2015, 3:10:14 PM4/27/15
to bots...@googlegroups.com
Your directory structure should look like this. With your grammar files (*.py) in the x12 directory.

bots/
    usersys/
        grammars/
            x12/
                __init__.py
                810004010.py
                850004010.py
                875004010.py
                997004010.py
                ...
                ...

It also looks like you are using a directory name in your translation. The Frommessagetype and Tomessagetype need to be one of your grammar files. For example, if you were translating to an x12 invoice, you would put 810004010 in the Tomessagetype box.

Craig Cook

unread,
Aug 4, 2015, 2:21:32 PM8/4/15
to Bots Open Source EDI Translator
Just to clarify the files in that directory...

You would also need to include "records004010.py"

Craig
Reply all
Reply to author
Forward
0 new messages