These are chat archives for pybee/general

3rd
Mar 2017
Russell Keith-Magee
@freakboy3742
Mar 03 2017 00:00
@SarthakSuri That error indicates that the code you’re testing isn’t valid Python to start with. You can’t put a literal newline in a single quoted string - you need to escape it.
Keep in mind that what the test is holding is a string - that is interpreted by Python, before being passed to Python. So you may need to use a double escape (’\\t’, ‘\\n')
Sarthak Suri
@SarthakSuri
Mar 03 2017 00:01
Makes sense, my bad
D3rvun1x
@D3rvun1x
Mar 03 2017 00:08
hello guys,i am Bate martin from Hibmat's University,Cameroon..second year student in computer engineering..i am soo interrested in contributing to the pybee project..i will start by asking help on how to install VOC in a virtual env in windows
Sarthak Suri
@SarthakSuri
Mar 03 2017 00:09
I was adding tests based on isWhitespace() but Python doesn't support the same characters
D3rvun1x
@D3rvun1x
Mar 03 2017 00:10
virtualenv -p "C:\Python35\python.exe" env
this just gives me an error"not recognised command"
Sarthak Suri
@SarthakSuri
Mar 03 2017 00:11
try pip install virtualenv
D3rvun1x
@D3rvun1x
Mar 03 2017 00:13
"pip install virtualenv" gives me a fatal error eventhough i had pip installed
Deepankar Agrawal
@deep110
Mar 03 2017 00:13

@freakboy3742 Yes, I think you are right, we need to make changes in visit_BinOp, I analyzed bytecode and it is calling BINARY_ADD

15 LOAD_CONST 3 (7.0)
18 LOAD_FAST 0 (x)
21 BINARY_ADD
22 RETURN_VALUE

D3rvun1x
@D3rvun1x
Mar 03 2017 00:14
it says"fatal error in launcher:unable to create process using '"'
Try to google stuff when you're stuck
I had some trouble setting it up too but someone has been through it before
D3rvun1x
@D3rvun1x
Mar 03 2017 00:16
yea right
thanks
ok i think i got it rite this time around..thanks @SarthakSuri
Sanjeev
@Sanjeev-S
Mar 03 2017 01:05
@freakboy3742
This is in regard to the timezone issue.
https://drive.google.com/file/d/0B9j9MJrQhCt2QlV2ZFpwWWloekk/view
With the given set of inputs, the value we are getting is 10344600 but the expected value according to the traceback is 10348200 (that is +3600 s from the value we get).
Traceback: https://codeshare.io/Gkm6BM
The timezone has no DST and on stepping through the code, no DST is added. So either the calculation of seconds from earlier has a bug or my question is, during testing where do you get the "correct" value to check with the calculated value? Is there a possibility that it can be wrong?
Sanjeev
@Sanjeev-S
Mar 03 2017 01:58
Shall I log it as an issue?
Sarthak Suri
@SarthakSuri
Mar 03 2017 02:28
Could someone more familiar with voc guide me to where strings are converted?
Anthony Shaw
@tonybaloney
Mar 03 2017 03:23
@freakboy3742 is there a seperate chat for dev of beeware, not just dev using beeware?
I have some q's about the process
Sanjeev
@Sanjeev-S
Mar 03 2017 03:32
No, it's the same
Anthony Shaw
@tonybaloney
Mar 03 2017 03:34
cool, what r ur feelings on http://up-for-grabs.net/#/
/our
i can see lots of things unfinished/missing, which is all cool. Figure it would be worth adding an issue every time I see one with #low-hanging-fruit or similar tags
If i suddenly go and raise 20 issues, it would help beginners who want to contribute to the project know where to start
Sarthak Suri
@SarthakSuri
Mar 03 2017 03:36
I think that would help
but try to let them know where to make changes as the file structure can be daunting at first
Anthony Shaw
@tonybaloney
Mar 03 2017 03:38
I help out on hacktoberfest every year and sit on a couple of OSS committees, time spent cataloguing missing features instead of dev'ing them ourselves pays its way 4x+
that person who makes 1 tiny change, but it's their first PR, feels awesome and ends up raising 2,3,4, etc.
absolutely. it takes a lot longer to document the issues because you're pretty much doing all the work for them, i.e. listing what needs to be done to complete the issue
Elias Dorneles
@eliasdorneles
Mar 03 2017 04:35
I'm not familiar with up-for-grabs.net the website, but I'm of the opinion that it's helpful to have small issues which are self-contained :thumbsup:
which is why I've been filing separated issues for every bug I could isolate and reproduce the problem
Russell Keith-Magee
@freakboy3742
Mar 03 2017 05:00
@tonybaloney No - my experience with Django has been that having the dev/user separation leads to frustration, because everyone goes to the dev list and asks user questions, no matter how much you signpost.
Happy to discuss process though - anything that helps bring on board new users and keep them contributing is of interest to me
Elias Dorneles
@eliasdorneles
Mar 03 2017 05:00
interesting. :)
Russell Keith-Magee
@freakboy3742
Mar 03 2017 05:01
Our process with onboarding to date has been this: http://pybee.org/contributing/how/first-time/
Which isn’t tied to a specific issue, per se, but does give concrete things to work on
However, “closing tickets" is also a much more familiar process - what sort of “issues” were you thinking of raising?
Elias Dorneles
@eliasdorneles
Mar 03 2017 05:05
I'd say we can just keep adding small tickets as we go, I mean, there is no need to stop-everything-and-create-all-the-issues
I imagine @tonybaloney was proposing creating tickets like "Implement enumerate", "Implement max", "Implement min", etc
Creating all those issues would be some tedious work :)
Elias Dorneles
@eliasdorneles
Mar 03 2017 05:17
So, I'd say it's better to add these kinds of tickets as we bump into them
We could have a small pool of those for VOC, for newcomers that for some reason didn't follow through the sequence of clicks needed to arrive at http://pybee.org/contributing/how/first-time/what/voc/
leasunhy
@leasunhy
Mar 03 2017 05:56
@freakboy3742 may I have your review comments on voc PR #363 and #377? Can't wait having my first PR to voc merged ;-)
Anthony Shaw
@tonybaloney
Mar 03 2017 06:01
@eliasdorneles not that granular. but somewhere along those lines
cool, there's VOC and Batavia getting started guides
D3rvun1x
@D3rvun1x
Mar 03 2017 12:54
got everything well but reached a certain point where i had a problem in running a python script through VOC..any help please
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 12:55
Which kind of script @D3rvun1x
D3rvun1x
@D3rvun1x
Mar 03 2017 12:56
the example.py(the get started tutorial)
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 12:56
Can you please share more info/screenshot
D3rvun1x
@D3rvun1x
Mar 03 2017 12:56
ok
Abhidnya Andraskar
@gEt-rIgHt-jR
Mar 03 2017 13:42
How do you make an Android app?
Using 'Python Android Template' and 'Toga'?
*cookiecutter
Elias Dorneles
@eliasdorneles
Mar 03 2017 15:34
So, right now, that's not working 100%
Normally, you never use Python-Android-Template directly
That template is meant to be used with briefcase: https://github.com/pybee/briefcase
And since the idea is for this to work for cross-platform apps, you'd write your app using toga APIs, install briefcase, write a setup.py and then do python setup.py android -- briefcase would be then responsible for creating the APK for your app
However, there is some work to be done for this to work correctly, so this isn't fully supported right now
If you want to make an Android-only app, the easiest way atm is to start from a plain Gradle app and integrate the VOC code, which is what I've done here: https://github.com/eliasdorneles/tictactoe-voc
So you can use that as a starting point to build your own app :)
You'll need to have a local clone of VOC, because it needs the latest bug fixes
I'll write a tutorial for it soon
D3rvun1x
@D3rvun1x
Mar 03 2017 16:03
image.png
image.png
@Deepanshu2017 thats the screenshot..
D3rvun1x
@D3rvun1x
Mar 03 2017 16:09
so the problem is i cant run the voc compiler over the .py script..
and this will be same for all my .py files
Abhidnya Andraskar
@gEt-rIgHt-jR
Mar 03 2017 16:13
@eliasdorneles Thank you so much, I'll try it
Elias Dorneles
@eliasdorneles
Mar 03 2017 16:14
@D3rvun1x are you working in a virtual env?
D3rvun1x
@D3rvun1x
Mar 03 2017 16:14
yes
Elias Dorneles
@eliasdorneles
Mar 03 2017 16:14
python voc <- that's not the way to run the voc script
you should install voc in your virtualenv, running pip install -e . inside the voc source code directory
then you should have a voc command available, which you can test running voc -v
if it's installed correctly, voc -v will print some usage information:
$ voc -v
usage: voc [-h] [-o OUTPUT] [-p PREFIX] [-n NAMESPACE] [-v]
           source file [source file ...]
voc: error: the following arguments are required: source file
D3rvun1x
@D3rvun1x
Mar 03 2017 16:16
am on it
Elias Dorneles
@eliasdorneles
Mar 03 2017 16:16
then you can run voc -v myfile.pyanywhere, as long as you're in the activated directory
okay, cool! :thumbsup:
D3rvun1x
@D3rvun1x
Mar 03 2017 16:16
no i mean am on it as in am following the processes now
Elias Dorneles
@eliasdorneles
Mar 03 2017 16:17
that's what I understood :)
D3rvun1x
@D3rvun1x
Mar 03 2017 16:23
i think i did an error
do i clone the voc directory into the venv?
well am sorri am new to the virtualenv stuff..and besides windows guy
Elias Dorneles
@eliasdorneles
Mar 03 2017 16:23
can you show the error message?
in any case, you don't need to clone voc inside the venv, the venv can be anywhere, but it needs to be activated
D3rvun1x
@D3rvun1x
Mar 03 2017 16:24
yes i did activate it and got something like venv>C:\python34~~
Elias Dorneles
@eliasdorneles
Mar 03 2017 16:25
okay, good
D3rvun1x
@D3rvun1x
Mar 03 2017 16:25
then later i closed that terminal reopening another terminal,the venv was no more
just having C:\python34~~
Elias Dorneles
@eliasdorneles
Mar 03 2017 16:25
ah yeah, the venv is only activated for the current terminal
so for every new terminal you have to activate the venv, if you want to use it
it's meant to be temporary, because you can have many venvs
once you activate the venv, then you can install voc by cd-ing into the directory of your copy of VOC
D3rvun1x
@D3rvun1x
Mar 03 2017 16:26
i thing thats from where my errors came in
Elias Dorneles
@eliasdorneles
Mar 03 2017 16:26
so, can you try again, knowing this? :)
D3rvun1x
@D3rvun1x
Mar 03 2017 16:26
ok got u
yes i can
Elias Dorneles
@eliasdorneles
Mar 03 2017 16:27
cool, good luck! :thumbsup:
D3rvun1x
@D3rvun1x
Mar 03 2017 16:39
image.png
i think i should add the voc path after the "-e" argument
sounds crazy,cus am already in the voc dir
Sarthak Suri
@SarthakSuri
Mar 03 2017 16:40
just add a period after the -e
it'll know it's the current directory
D3rvun1x
@D3rvun1x
Mar 03 2017 16:42
image.png
after appending '' to the -e arg, i got this ..
ok period good
yea its now working ,thanks..i think i would be able to help someone too
Sohit
@sohit-nayak
Mar 03 2017 16:48
hello everyone! I am new here, and am looking forward to contribute to voc!
:smile:
D3rvun1x
@D3rvun1x
Mar 03 2017 16:57
ok welcome @sohit-nayak you migth want to go through these steps first https://voc.readthedocs.io/en/latest/intro/index.html
dont hesitate to ask for help on any place u find yourself stuck
Sohit
@sohit-nayak
Mar 03 2017 16:59
thanks.. On it!
D3rvun1x
@D3rvun1x
Mar 03 2017 17:00
good
Elias Dorneles
@eliasdorneles
Mar 03 2017 17:09
glad you got it working, @D3rvun1x ! :+1:
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 18:14

The signatures there are meant for defining how these will map to the objects received on the Java code

Ahh makes sense. @eliasdorneles

I must say I was here for GSoC but this project really seems interesting to me and I would love to contribute in this project outside of GSoC scope too
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 18:28
When we say there is an instance of org.python.types.Type that refers to org.python.types.Dict; and all instances of org.python.types.Dict contain a reference of that org.python.types.Type instance. Are we saying that All the instances of org.python.types.Dict will contain reference to a single particular instance of org.python.types.Type
or we mean that each Dict instance will have a reference to a different Type instance.
D3rvun1x
@D3rvun1x
Mar 03 2017 18:37
ok i got through with the getting started and i have understood how voc operates when headed to "how to contribute",how do i go along?..do i get to study how byterun operates? and how to implement or buil a python interpreter
Siddharth Prajosh
@sprajosh
Mar 03 2017 20:17
Hey guys, I'm Siddharth from Kochi, Kerala (India). Doing my Bachelor's Degree in Computer Science.
New to BeeWare, excited about GSoC. I have been active in open source community works but it's my first time in an open source organization.
I like the idea of a converting Python code to Java so as to run it on all machines with JVM and that's what I'll be concentrating on.
Cheers.
Atef Hares
@atefhares
Mar 03 2017 20:29
Hi, What should we currently as a first step for applying to GSoC?
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 21:27
@freakboy3742 you up?
Russell Keith-Magee
@freakboy3742
Mar 03 2017 21:27
@Deepanshu2017 I am
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 21:27
How we are raising exceptions?
Russell Keith-Magee
@freakboy3742
Mar 03 2017 21:28
Can I have a little more context for that question? Are you using VOC? Batavia?
Ok - in VOC, a Python exception is a Java exception.
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 21:29
yep
Russell Keith-Magee
@freakboy3742
Mar 03 2017 21:29
So we’re using the Java opcode to throw an instance of java.lang.Exception
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 21:29
Okay let me tell you what I am working on and what information I need
Okay so I am working on the bug that @eliasdorneles pybee/voc#352
After digging into the source code (of course I am still new to the code base so it took me time to find methods and other things) I found that functions are invoking by the invoke method in Function.java file
but in case of exceptions even though the invoke method is called but it not printing the debug logs
Russell Keith-Magee
@freakboy3742
Mar 03 2017 21:31
Correct
Russell Keith-Magee
@freakboy3742
Mar 03 2017 21:32
Ok - so KeyError() isn’t a function - it’s a constructor for an instance of the KeyError class.
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 21:33
Now that I am correct with most of the part (As you confirmed ) I found that the root cause for the bug is java.lang.NoSuchMethodError: org.python.exceptions.ValueError.<init>(Lorg/python/Object;)V
Russell Keith-Magee
@freakboy3742
Mar 03 2017 21:34
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 21:34

Ok - so KeyError() isn’t a function - it’s a constructor for an instance of the KeyError class.

Not about KeyError() but also for ValueError too

That seems odd, because https://github.com/pybee/voc/blob/master/python/common/org/python/exceptions/KeyError.java that method should exist

Oh yes right

Russell Keith-Magee
@freakboy3742
Mar 03 2017 21:34
All exceptions. And all object construction, for that matter.
Instantiating an object isn’t a function call - it’s an instantiation of an instance.
so it’s a different invoke() method.
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 21:36
and what that invoke() method is. I completely understood that ValueError() and other exception instantiation is different from calling other invoke() method from already existing instances
@Deepanshu2017 If you compare the implementation of KeyError, and the implementation of ValueError, you should be able to see the problem pretty quickly. KeyError works. ValueError doesn’t.
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 21:38
yes working on that :)
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 21:48
Haha fixed ValueError :D
Will create a PR soon.
Thank you @freakboy3742 for the help and patience :)
Russell Keith-Magee
@freakboy3742
Mar 03 2017 21:50
No worries at alL!
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 21:52
I am actually not happy with myself. It took me around 4-5 minutes to find the bug but maybe because it's 3:22 AM here
Russell Keith-Magee
@freakboy3742
Mar 03 2017 21:53
Possibly an indication that sleep is required :-)
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 21:53
haha but some Strings are still confusing me ;) ;) If you know what I mean
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 22:09
We are following pep8 guide. right?
Russell Keith-Magee
@freakboy3742
Mar 03 2017 22:09
Correct
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 22:09
:)
Russell Keith-Magee
@freakboy3742
Mar 03 2017 22:09
if you run flake8 from the command line, it will enforce all the style guides on python code and tell you any deviations.
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 22:10
yep
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 22:17

@freakboy3742 One more thing. I don't know if it is intentional or not but check this code.


def foo():
    print("Hello, World!")
    return
    print("Hello, World! Again")


if __name__ == "__main__":
    foo()

In Java if we have code after return statement, then compilation fails. But if you run above code with voc and java it will output:
Hello,World!
Hello,World! Again

Russell Keith-Magee
@freakboy3742
Mar 03 2017 22:18
Ok - that’s definitely a flaw. It’s completely legal Python code - although it would reveal a flake error - but Hello,World! Again shouldn’t be printed...
Can you log that as a bug?
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 22:18
yes sure :)
flake8 foo.py is not giving me any error or warning. I have saved above code in foo.py file.
Russell Keith-Magee
@freakboy3742
Mar 03 2017 22:21
Really? I would have thought it would have registered as unreachable code...
I may well be wrong.
(and evidence suggests I am)
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 22:21
haha
Sarthak Suri
@SarthakSuri
Mar 03 2017 22:22
@freakboy3742 So I got case conversion to work in java but it still throws a UnicodeDecodeError in VOC
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 22:22
I am kinda falling in love with this project :)
Russell Keith-Magee
@freakboy3742
Mar 03 2017 22:22
Aw, shucks :-)
Sarthak Suri
@SarthakSuri
Mar 03 2017 22:22
It seems like there are utf-16 characters left in the string
Russell Keith-Magee
@freakboy3742
Mar 03 2017 22:23
@SarthakSuri Ok - this is where you have to step through with a very simple string, where you know the exact byte order and byte encoding, and work out where things are going awry.
Sarthak Suri
@SarthakSuri
Mar 03 2017 22:23
Any suggestions? I tried re-encoding it but that just made it worse
Okay
How should I test it though?
I've just been running tests from the command line
Russell Keith-Magee
@freakboy3742
Mar 03 2017 22:24
You’re not looking to write a test here - you’re stepping through the code manually, to confirm exactly what is happening.
So everywhere that a buffer is returned/encoded/decoded/inserted, make sure it has exactly the right content.
Sarthak Suri
@SarthakSuri
Mar 03 2017 22:26
Oh, okay. I'll do that
Thanks
Jonas Schell
@Ocupe
Mar 03 2017 22:28

I have a question regarding pip installing a local version of toga. I cloned toga and have it on my system. Now I do: pip install -e /path/to/toga and get this:

(venv) Macintosh:my_test_apps Jonas$ pip install -e ../toga
Obtaining file:///Users/Jonas/Documents/Programming/PyBee/toga
Collecting toga-cocoa (from toga==0.2.4)
  Using cached toga_cocoa-0.2.4-py3-none-any.whl
Collecting toga-core>=0.2.4 (from toga-cocoa->toga==0.2.4)
  Using cached toga_core-0.2.4-py3-none-any.whl
Requirement already satisfied: rubicon-objc>=0.2.2 in ./venv/lib/python3.5/site-packages (from toga-cocoa->toga==0.2.4)
Requirement already satisfied: colosseum>=0.1.3 in ./venv/lib/python3.5/site-packages (from toga-core>=0.2.4->toga-cocoa->toga==0.2.4)
Installing collected packages: toga-core, toga-cocoa, toga
  Running setup.py develop for toga
Successfully installed toga toga-cocoa-0.2.4 toga-core-0.2.4

It seems like that toga-core and toga-cocoa are not installed from the local version but instead from PyPi.
How can I install a local version in my venv?

Russell Keith-Magee
@freakboy3742
Mar 03 2017 22:28
@Ocupe Ok - you have to do it manually, and starting from the bottom up.
That is - pip install -e path/to/toga/src/core then pip install -e path/to/toga/src/cocoa
Jonas Schell
@Ocupe
Mar 03 2017 22:32
I tried but I get this:
(venv) Macintosh:my_test_apps Jonas$ pip install -e ../toga/src/core/
Directory '../toga/src/core/' is not installable. File ‘setup.py' not found.
Russell Keith-Magee
@freakboy3742
Mar 03 2017 22:33
Hrm...
Jonas Schell
@Ocupe
Mar 03 2017 22:33
But I checked and there is a setup.py file in the folder
Russell Keith-Magee
@freakboy3742
Mar 03 2017 22:33
Have you tried cding into the core directory and trying there?
I’m wondering if maybe the trailing slash or the .. might be the problem...
Jonas Schell
@Ocupe
Mar 03 2017 22:40
Got it! I had a old version of toga. Your first answer worked for me. thanks!
there was no setup.py file in core and cocoa
Russell Keith-Magee
@freakboy3742
Mar 03 2017 22:41
Well that’d do it :-)
Jonas Schell
@Ocupe
Mar 03 2017 22:42
That is so much better than having to copy toga over every time a make a change. Professionally I’m coming :D
Thanks for your tip and good night!
Russell Keith-Magee
@freakboy3742
Mar 03 2017 22:44
g’night!
Deepanshu Thakur
@Deepanshu2017
Mar 03 2017 22:59
@freakboy3742 check this pybee/voc#382
Sarthak Suri
@SarthakSuri
Mar 03 2017 23:42
The uppercase conversion works but somewhere along the line print breaks down and lets the codepoints through. Printing non-ASCII leads to a UnicodeDecodeError or unicodeEncodeError if the character isn't from the Latin set.
I was only checking for non-ASCII characters earlier so I never checked if the print function could handle them
But this could also be due to windows using cp1252 on some file so I'll try working on other stuff until I have a better working environment.
But I'd be happy to share what I know if someone else wants to try implementing print for non-ASCII characters