Errors parsing generate.py in libopc 0.0.3

Coordinator
Dec 19, 2013 at 1:23 PM
Edited Dec 19, 2013 at 1:29 PM
Hi,

(On Windows 7 here..)

I'm attempting to run this command as mentioned in the README:
c:\Python33\python.exe generate.py --include Makefile.xml win32-*-msvc-**
But there are a variety of errors reported with the mixed-use of spaces and tabs in generate.py.

I think I've managed to fix most of those (but not knowing Python, I'm really only optimistic that I've changed it property. Here's an example:
  File "generate.py", line 147
    else:
    ^
IndentationError: unexpected indent
But this one has me stumped as it looks correct:
  File "generate.py", line 704
    print "symlink("+ln_dst+", "+ln_src+")"+str(os.path.exists(ln_src))
                   ^
SyntaxError: invalid syntax
So my questions are:
  1. I'm using Python33 instead of 26 as the README uses. Should that matter? I didn't find a Windows installer for 26 that's why I'm using the latest.
  2. Does anyone else see these issues? Do you have a corrected version of generate.py?
Thanks for any tips,
John
Coordinator
Dec 19, 2013 at 2:13 PM
It would appear that print in Python needs parens around the arguments. Adding those allowed me to get past this error on to the next one....
Coordinator
Dec 19, 2013 at 3:52 PM
Hi

I use pyhton 2.7.2 which works for me. Can you try using this version. Maybe they got more strict in future versions...
They still have 2.7.6 on the download page http://www.python.org/getit/. Can you give it a try and let me know what happened?
Florian


Marked as answer by jschroedl on 12/19/2013 at 8:11 AM
Coordinator
Dec 19, 2013 at 4:08 PM
Edited Dec 19, 2013 at 4:09 PM
[Update: Thanks flr, I did exactly that and it's working now!]

I threw in the towel and found an installer for Python version 2.7 and Hey! what do you know, generate.py ran fine with that. So the lesson for future visitors is to find an older version of Python.

Side note: WTF kind of language makes massive breaking changes between versions?
Coordinator
Dec 19, 2013 at 4:12 PM
Hi,

yeah --- I heard that 2.xxx and 3.xxx are different. I wonder when its time to upgrade to 3.xxx. Btw. I ended up using 2.xxx because the XML parsing libraries where not working in 3.xxx at the time I was using it... Maybe I need to try again...

Thanks for the feedback.

Florian



Oct 22, 2014 at 1:11 PM
Edited Oct 22, 2014 at 2:22 PM
We ran the generate.py command for VS against the generic libopc_0.0.3.tar.gz code version, but it's not working. Did you use a different code download?

Did your Visual Studio project work after you successfully ran the command? I found that after I got generate.py to run, the VS project had errors in the opc_proc.vcxproj file. When I had VS fix the project, it still had load failed for all of the items under solution (mce, mce_extract, etc.... entire list).
Coordinator
Oct 22, 2014 at 8:02 PM
I just re-loaded the solution I had generated way back during my research. It's in a folder named libopc-20526 and it looks like I must have started with libopc 0.0.2 but it's kind of hard to tell what the version # is. Where is that? I do see that I un-tar/zipped the 0.0.3 code too but the README is identical.

Just dug a little deeper and I am using 0.0.2 files in our product. For that, I made my own static library project and added the files to that with the proper include paths. I have a libopc project with dependencies on two others (libxml2 and zlib). I needed to add a variety of casts to satisfy our static code analyzer run.

I plan to look at moving to 0.0.3 when we ramp up our next major version. Sorry I'm not much more help. FWIW, I haven't hit any bugs to be blamed on libopc in ~6 months of serious dev work with it.