#beeware

/

      • bsdtux joined the channel
      • bsdtux
        hey everyone: I am working through the VOC test and I am at the part where it says to use ant java to compile a support library. It says command not found.
      • Would this be apache's ant that I need to download. I am using oracles java jdk 8u66 on Mac OS X
      • Got it working.
      • So I think my environment setup must be wrong. I can't seem to run the test_utils.py or the simple python app that has been compiled.
      • guruprasad joined the channel
      • guruprasad
        Ping
      • bsdtux
        Hi guruprasad
      • guruprasad
        I was trying to get started with voc and wrote a simple python program
      • I cloned the voc repository, ran 'pip install -e .' within an python 3.4 virtualenv environment. I also installed ant (from MacPorts since I am on OS X) and built the support libraries without any issues.
      • I wrote a sample python program - https://dpaste.de/PKiV
      • It runs fine with python. When I compile it with voc, it creates a MyClass directory within the python directory and within it MyClass.class and __init__.class
      • But when I run it using 'java -XX:-UseSplitVerifier -classpath dist/python-java.jar:. python.MyClass.Myclass', I run into java.lang.VerifyError. Full traceback here - https://dpaste.de/u8rY
      • bsdtux
        thats better then me. I keep getting Error: Could not find or load main class python.example
      • guruprasad
        Not sure if I am doing something wrong or if it is a bug
      • bsdtux
        Are you using Java 7 or Java 8.
      • guruprasad
        Java 8
      • bsdtux, even I used to get the same error. But realized that python/example is the folder structure
      • bsdtux
        try switching to java -noverify instead of -XX:-UseSplitVerifier
      • guruprasad
        and after using python.example.example, I started getting the VerifyError
      • bsdtux
        Well I now get the following so I feel it is a step in the right direction Error: Main method not found in class python.example.Example, please define the main method as:
      • public static void main(String[] args)
      • guruprasad has quit
      • hey freakboy3742
      • freakboy3742
        bsdtux: Howdy!
      • bsdtux
        got a second to help.
      • freakboy3742
        Certainly - what's up?
      • bsdtux
        when I try to run my test app I get a please define the main method as public static void.
      • freakboy3742
        Hrm - ok; can't say I've seen that in my testing
      • bsdtux
        Not sure if I did this right. Here is what I used for my test. http://pastebin.com/cG9SnCBa
      • freakboy3742
        Some preliminary stuff: What version of Java are you using?
      • bsdtux
        Java 8up66 with Python3.4 on Mac OS X 10.9
      • my initial setup was to fork the VOC then do a git clone. then I followed the instructions to do a virtualenv -p <path to python3.4> voc
      • freakboy3742
        Just so you're aware - Java8 introduces some hard requirements on class files that I'm not completely compliant with yet
      • so you'll have to use the --noverify option when you run
      • (IIRC think that's in the docs now...?)
      • Looking at your pastebin, though:
      • What you've done isn't *wrong*, but I don't know if it will work, either :-)
      • A "hello world" for VOC should look like a normal Python hello world - just the print statement
      • Or, if you want to be more fancy, using the
      • if __name__ == '__main__':
      • check
      • it converts *that* pattern in to a "static void main()"
      • bsdtux
        ok let me test that.
      • freakboy3742
        What you've done - define a class that has a static void main - that definitely *should* work in time, but I'm not sure it will right now.
      • There's still some rough edges around static methods, and java requires a specific prototype for it's main
      • so your method would proabaly need to be somethign like:
      • def main(args: Array(java.lang.string)) -> void:
      • (except that "array" doesn't exist, so there's the first problem)
      • Does that make sense?
      • bsdtux
        Would that be valid python code
      • freakboy3742
        Yes - it's valid Python3, with all the type annotation stuff
      • bsdtux
        ok. I am thinking though just to get me started and take away some of the headaches I should remove jdk 8 and go with jdk 7
      • ok I tried one other thing which was to create a normal python file with a single print("Hello World") and compile it with voc.
      • this create python/example/__init__.class. then doing java -noverify -classpath dist/python-java.jar:. python.example
      • I get Error: could not find or locate main class.
      • freakboy3742 facepalms
      • freakboy3742
        There's a documentation update needed after what I pushed yesterday.
      • add ".__init__" to the end of your java invocation.
      • bsdtux
        SCOOOOOORE
      • that worked.
      • I wonder if I should edit the README.rst and add like a full tutorial section that shows working python code?
      • freakboy3742
        That would be a fantastic contribution, and most appreciated.
      • bsdtux
        Alright let me get to work on that. Might be tomorrow as it is 2:45 AM here in Nashville TN
      • freakboy3742
        Alternatively, you could add it to the (very much stub) docs as a tutorial, and reference that tutorial in the README.
      • Entirely understandable :-) It's 5 in the evening here in Perth.
      • bsdtux
        ah I like that idea better.
      • I think I used that docs directory already to setup my voc test environment.
      • freakboy3742
        If you've got a moment for a quick PR, though - updating the execution docs to talk about the __init__.class bit would be helpful.
      • If you need your sleep though, that's fine - I'll update it myself when I've finished the thought I'm in the middle of.
      • bsdtux
        sure, but stupid question. where is that execution doc?
      • my docs directory seems to only have index, internals, Makefile. but no execution
      • Pull request has been submitted.
      • freakboy3742
        Cheers.
      • bsdtux:^
      • For the pull request that is.
      • As for where the execution docs are... well, other than the README there isn't much at all.
      • Step one - put some structure in place.
      • I might take swing at that tonight so you've got some scaffolding to work with in the morning.
      • bsdtux
        cool. Well have a good one Going to bed now. I might need some help tomorrow running the tests. I couldn't get those to run.
      • freakboy3742
        Hrm. Ok - happy to help diagnose.
      • bsdtux
        Real Quick before I get off here. Thanks for helping me out.
      • The whole world of Dev is new to me. My primary job is Systems Administration (OPS) side of the house.
      • bsdtux has quit
      • bsdtux joined the channel
      • Can someone walk me through how to run the tests. I tried I get SystemError: Parent module '' not loaded, cannot perform relative import
      • When I fix that error by adding import os, sys and doing a sys.path.insert(0, os.getcwd()[:-9]) I just get blank output