« first day (3460 days earlier)      last day (1493 days later) » 
00:00 - 17:0017:00 - 00:00

12:57 AM
Cabbages everyone
 
 
4 hours later…
4:31 AM
Hi, any idea about solving Question 2 here - geeksforgeeks.org/infosys-certification-exam-infytq
Here it is
 
on Q2 example 2.. i don't understand why 1, 5, 6 isn't a sequence
 
Yes, it will be an answer
 
just sort the input list of numbers, then recursively test the formula with preceeding numbers
 
4:46 AM
ok, can you give some more hint?
How will be the recursion? Like fibonacci?
 
i don't know. I'd have to start playing with some code to figure it out far enough to give you more of a clue. But, that would be tedious for me.
 
best way to approach these is to open up your favorite python shell, like PyCrust and write a crappy function as a starter.. then iteratively make improvements to it
intuitively, you know you're looking for sets of 3 numbers where the third is the sum of the preceding two
or grab a pencil and paper... and write some pseudocode and maybe doodle out some ideas
if you persist, you'll eventually figure it out
 
cbg guys o/
 
4:58 AM
cbg
 
6:09 AM
descriptors are bending my brain tonight... making decorators for class methods
 
6:32 AM
brief cbg
 
7:04 AM
@Todd you mean your own classmethod type?
 
I was looking at making a descriptor that would allow me to define decorators as class members.
something like: @decoratormethod\n def foo(self, func):...
 
ah, you mean properly calling foo's getter to bind self?
 
yeah.. i know.. there's holes in this idea =)
foo would be a decorator.. declared as a class member
hard to get around things when the class is being defined and nothing is bound
 
I'm still not entirely sure what you're even trying to do. ^^
 
I don't get it. Decorators are just callables, and methods are callables, so... what's @decoratormethod even doing?
 
7:12 AM
probably because the whole idea is seriously flawed =)
generally, I declare my decorators as functions not bound to a class. I was playing with the idea of being able to declare decorators as methods of a class
of the same class they're intended to decorate other methods of
 
@Aran-Fey well, there's some extra headache from decorators having to explicitly bind the method on lookup – which is why we have partial and partialmethod, singledispatch and singledispatchmethod, ...
 
yeah.. i was looking at the implementation of singledispatchmethod
 
@Todd still not 100% sure whether by "class method" you mean a "classmethod" or a regular method
 
i mean regular method.. might be possible with static methods
 
@Todd And the decorator itself needs access to a self?
 
7:17 AM
well.. it really can't have access to self during declaration.. so yeah.. they might have to be treated as static
but even that might be useful
 
@Todd I'm not 100% sure whether we need these separate implementations and they aren't just for simplicity. Not having looked into it too much, it should suffice if the decoarator's __get__ triggers "method mode" and it's in "function mode" otherwise.
 
If the decorator needs a self then you have to do it in 2 steps - the decorator only marks the method as "needs to be decorated later when a self exists" and then in the __init__ you actually replace the method
 
well I put the idea aside.. i figured out another implementation for the feature I was considering this for.. maybe at some later point I'll pick it up again
 
What you seem to be on is that a method isn't a method in the class body.
 
yeah.. that's an idea.. having two modes to the decorator.. one for during class definition.. then one for the behavior on the first call.. 3 modes maybe
 
7:19 AM
Hi everyone, can you please tell me if python3 will be able to run python2 django projects?
 
in general, no.
python3 cannot run all python2 code.
 
so we need to setup python2 env for python2 code
even virtual env should be of python2 ?
 
IIRC that's especially the case for web frameworks, since they deal a lot with bytes/strings/unicode
my recommendation is to port the project to python3
 
Good save...
 
heheh
 
7:20 AM
nothing to see here. move along. :D
 
sorry what do you mean by port the project to python3?
 
I think you can start by using the future package.. and add a feature.. debug.. add another feature... debug.. etc
 
thanks, let me see that
one more thing where can we see exactly what's the python version used for a django project
 
7:41 AM
@HabibRehman one way is to use ./manage.py shell -c "import sys; print(sys.version)"
 
thanks
checking it
 
8:00 AM
alright i got it checked now i am search another one :D
why can't i download mysql-connector=2.1.4
its a fckng old project and i am having trouble installing the requirement txt file
the version it got installed is 2.2.9
ERROR: Could not find a version that satisfies the requirement v==2.1.4 (from versions: 0.0.0)
this is what i get as resopnse
the least older version i can see is 2.1.7
 
@HabibRehman we like to keep things kid-friendly here, so kindly abstain from the profanity
 
ops, sorry
 
@HabibRehman might help to have your actual dependencies listed down & then determine which one should determine the other's versions
If other dependency versions aren't pinned (==2.1.7) like the mysql-connector's then some dependency might be getting installed as per latest, which requires a higher version of mysql-connector. Hence the issue.
 
list of dependencies
i am actually getting error for mysql-connector-2.1.4 when i am trying to install the requirement.txt
and when i look into the doc for python mysql-connector they least have is 2.1.7 i got it installed though, should i change the version in requirement.txt by 2.1.7
then i think it migt break something else
 
8:18 AM
You can try 2 approaches -
1. Check the log, see what packages require the specific version, check their source code if they can be upgraded so that the connector is the newer version. Rinse repeat.
2. Install dependencies by hand, from scratch, with most required / important project dependency first (e.g. django)
3. Do step number 2 with a tool like [poetry](https://python-poetry.org/)
 
thanks shadow, looking into it
 
8:32 AM
2 approaches, gives 3. nice
 
8:52 AM
Morning guys...any ideas how I can soften the edges of this image ?
 
@AnotherUser31 doesn't seem particularly Python related? Also - wouldn't the concern be changing the hideous colour of the shoe itself :p
 
why not Particularly Python ? u mean it's not possible to achieve a smooth edge in Python ?
 
Well... what's your starting point... have you installed any image processing libraries and tried those?
 
yes...Potrace is doing a great job. Problem is I can't use Potrace while deploying the app on heroku
wondering if there's something pure python that can achieve the same
 
@AnotherUser31 ah, the beauty of gpl licensed software
pillow is popular and licensed under MIT
 
9:07 AM
I mean there's a buildpack...but no clue how to connect it to my app... I have it like : os.system(f"potrace -b pgm {pgm_file} -o {new_file}")
this is the buildpack....
 
oh, it's not a licensing problem? if it's just about calling that potrace lib correctly you should look into subprocess.run, it's a better interface to system calls.
 
@Arne interesting ! that would be great ! mind helping me with that subprocess.run thing ?
 
I had hoped just dropping doc links would be enough since I'm not familiar with potrace at all
if you read it and tried around a little without getting it to work I can try
 
Probably worth searching for "potrace python binding" or something
 
@Arne alright, lemme try...so first I have to install that buildpack, right ?
 
9:16 AM
sorry, also no clue about heroku either
 
:))) ok
 
Does conda does the same thing that virtualenvwrapper+virtualenv does?
(I mean the virtual environment manager of conda)
 
@Arne No such file or directory: 'potrace -b pgm ./static/AUBM206/AUBM206-1.pgm -o ./static/AUBM206/AUBM206-1.jpg': 'potrace -b pgm ./static/AUBM206/AUBM206-1.pgm -o ./static/AUBM206/AUBM206-1.jpg
at least the app now didn't crashed like last time...
i used it like this :
subprocess.run(f"potrace -b pgm {pgm_file} -o {new_file}")
and before it was os.system(f"potrace -b pgm {pgm_file} -o {new_file}")
 
It's much saner to use run that takes a list instead of a string...
 
9:34 AM
@JonClements hmmm...so you think that's the problem ? because I can see the files on my machine they are there...at that path
 
@AnotherUser31 probably handy to specify the fullpath to potrace instead unless you're using shell=True
 
i don't use shell=True...where would that go ?
 
look at the docs and the security note that I believe goes with it for subprocess.run... but I'd still go for providing it as a list and being explicit with paths
 
how would my path look like when deployed on heroku ? all my files are going into ./static/ folder
 
9:46 AM
I guess you could use which potrace to give you the full path to the executable
 
in a terminal, not in python
@AnotherUser31 it seems nobody made this explicit to you: pass the arguments as a list
subprocess.run(['potrace', '-b', 'pgm', pgm_file, '-o', new_file]) or something like that, I'm not sure about the switches
 
@AndrasDeak lemme try that
 
@AndrasDeak that's exactly what I was implying :)
 
sorry guys :)))
 
@JonClements I know, but it was only clear if you already knew that :P
 
9:50 AM
(but probably need explicit paths as it doesn't work the same as a shell for look ups...)
 
so when I do which potrace i get only the local path /usr/local/bin/potrace
 
@αԋɱҽԃαмєяιcαη really no need for that first comment...
 
@JonClements the question being asked 3rd time yet. he/she deleted the recent previous one btw
 
I noticed... but doesn't make that comment necessary... at least not with that tone :)
 
9:59 AM
so now i get this :
TypeError: expected str, bytes or os.PathLike object, not set
when changes to @AndrasDeak solution
 
@AnotherUser31 so don't pass a set
you left the braces from the f-string, didn't you?
 
{} u mean ?
yes
should i take them out ?
 
@JonClements i think that i said please which is completely honest way. not in the order way. but anyway i will change the way of it in further comments . thanks for the point
 
It's alright, it can be hard to copy-paste code
Some people learn it on SO for years
 
:D :D @AndrasDeak sorryyyyy
alright, now I got this : FileNotFoundError: [Errno 2] No such file or directory: 'potrace': 'potrace'
 
10:06 AM
@AnotherUser31 OK. Now comes the full path
 
@AndrasDeak how do I optain that path again ? it returns only my local potrace path when I do which potrace
when I do heroku which potrace I get : Error: command potrace not found
 
Instead of just putting potrace as your first argument in the list... put the full path instead... /usr/local/bin/potrace
 
@JonClements so on heroku it will also be /usr/local/bin/potrace ?
 
if which potrace isn't finding anything on heruko then do you actually have it on heruko?
 
I did installed that buildpack
 
10:19 AM
okay... so you need to check that worked properly and where it's gone to...
 
10:30 AM
@JonClements I did exactly like it says in the instructions
Creating app... done, ⬢ hidden-atoll-03581
Setting buildpack to https://github.com/gertjanspriensma/heroku-buildpack-potrace.git... done
https://hidden-atoll-03581.herokuapp.com/ | https://git.heroku.com/hidden-atoll-03581.git
 
instead of looping over a nested JSON dict. are there a package which pickup the value by the key directly ?
I've seen many solutions to find occurrence by key, such as that but even it's by looping over.
 
heroku which potrace
› Error: command potrace not found
 
10:46 AM
I have a 26GB JSON file and 8GB of RAM. Is there a way for me to stream the JSON file?
 
11:10 AM
so now i installed packages one by one and everything goes fine, now when i run requirements install command everything is being picked except one
I am getting this error:
https://pastebin.com/5FDyiaHL
"Building wheel for GeoIP (setup.py) ... error"

is there something wrong with my wheel now?
 
does someone know the default open buffer size for a text file? the docs only mention binary files and interactive text files.
 
no idea, this is still alien to me
 
cbg all
 
how are you ahmed?
 
11:21 AM
am doing well. thanks for asking @superv :p hope you are fine as well
 
cbg stands for?
 
I am doing well too @αԋɱҽԃαмєяιcαη Hope the situation isn't bad from your end?
 
@superv No, it's fine at all
@superv they managed to close the hospital and move the patients to another one
 
11:39 AM
@MisterMiyagi the buffer grows as large as it needs to fit the line, no?
ugh, clearly I'm still half asleep
Maybe I'm not the only one, though? It says "Other text files use the policy described above for binary files."
 
Ah, yes, completely overlooked that. Perhaps that's my hint to go for a coffee....
 
I have a string containing lat and longs, I need to split it in two. e.g. from 1234N1234E, I need lat = 1234N and long=1234E. Sometimes the string looks like 1234S1234W. What is the best way to do it? I've tried regex, find etc. and of course it's possible, just want to get some more suggestions which could be simpler.
 
I can recommend split or partition for such simple tasks
 
what would you split on, though? Regex seems like the easiest solution there
lat, long = re.match(r'(\d+[NS])(\d+[EW])', text).groups()
 
        lat_match = re.match("\d+.\d+[NS]", point["lat_long"])
        if lat_match:
            lat = lat_match.group(0)
        lon_match = re.match("\d+.\d+[EW]", point["lat_long"][len(lat):])
        if lon_match:
            lon = lon_match.group(0)
I ended up with this, I forgot to mention that there could be decimal points in the numbers
 
11:55 AM
in the general case I suppose you want \d+(\.\d+)? or maybe some variation -- do you permit zero suppression like .1234? what about in the other direction 1234. to signify 1234.0 with no explicit decimals?
@Aran-Fey I guess you'd want to split out the numbers to their own groups, like r'(\d+(?:\.\d+)?)([NS])(\d(?:\.\d+)?)([EW])'
what about negative numbers? like -1N = 1S
 
oh man, harder than I thought, I didn't know re.match(...).groups() was a thing.
@tripleee all good questions, when there is a decial point it's simply xxx.xxx with x > 0
but it's not an interview question so no need to cover all conveivable cases, edge cases are spotted easily
 
heh, which x? (^8
I'd think mentioning (if not solving) the corner cases would be kind of the point with an interview question
 
1234.1234
yes it would be, but this isnt
 
@Aran-Fey a simple point.partition('N') if 'N' in point else point.partition('S')
 
@MisterMiyagi exactly what I'm doing now : ) regex just ended up too messy.
never used partition before, so thanks for the suggestion
 
12:04 PM
it's a borderline case, but I generally prefer string methods because they are more readable
 
12:16 PM
Hi everyone!
I've already installed "keyring", but I got the same error
import keyring
ImportError: No module named keyring
 
@jigglypuff negative sign prefix?
@G.Alexander install with python -m pip to be sure
 
@AndrasDeak Thank you. I will try...
 
And sometimes the package name is not the same as how it's imported
 
Yeah, I see. I got an error on "import urllib", but now I changed it in to "from urlparse import urlparse"
@AndrasDeak, The same happened. "Import Keyring"
 
Two capitals?
 
12:23 PM
No.
 
OK
Are you in a venv and did you use the same python command with pip as for running the script that's trying to import?
 
python -m pip install keyring
python -m pip3 install keyring
both are now working...
 
What is "now working" here?
I thought pip worked in the first place, and only the import didn't. You can't expect an import work if pip failed.
 
* not working...
 
OK...I can't help you
 
12:26 PM
???
Something wrong on my dev-environment?
I use MXLinux i386 (Debian) now.
 
@G.Alexander Probably not. But your responses are contradictory and confusing enough that I don't have the mental capacity to keep doing this until we reach a point where we figure out what actually isn't working. Others might help you still, just not me.
 
@G.Alexander you've being asked if you trying this under virtual environment or not.
 
Of course yes, I am using VM. Why?
 
if you installed the package under venv, you will can't import it outside of venv !
I'm not asking if you using virtual machine ! you've being asked about Virtual Enviroment
 
...VM? As in Virtual Machine?
 
12:29 PM
@Aran-Fey probably
 
VENV??? I don't think so.
 
seems you don't know what is venv ? yes?
 
Yes.
I don't know well about VENV.
 
which means you don't use venv at all. so you've been able to install the package without any error ? yes/no ?
 
Yes.
 
12:31 PM
now, what happens when you import it ? show the error ?
 
No error. but my project is not working.
on line: import keyring
I think I instsalled keyring well, I can check using "pip3 install keyring".
Requirement already satisfied: cffi!=1.11.3,>=1.8 in /usr/local/lib/python3.7/dist-packages (from cryptography->SecretStorage>=3; sys_platform == "linux"->keyring) (1.14.0)
Requirement already satisfied: pycparser in /usr/local/lib/python3.7/dist-packages (from cffi!=1.11.3,>=1.8->cryptography->SecretStorage>=3; sys_platform == "linux"->keyring) (2.20)
 
@G.Alexander "No error. but my project is not working." why you assume that the error within the package? if you have no issue with it? you have to check your project itself then! if it's not related to importing package issue !
 
python already installed on MXLinux. I didn't uninstalled it.
This is my commands typed for installation.
---
apt install python-pip3
sudo apt-get install build-essential libssl-dev libffi-dev python3-dev
pip3 install cryptography --no--binary cryptography
pip3 install keyring
 
in other word, what do you mean by my project is not working.?
 
@αԋɱҽԃαмєяιcαη I mean no error on "pip3 install keyring". But ...
 
12:37 PM
@G.Alexander did you previously run python3 -m pip install keyring or python -m pip install keyring?
 
python myProject.py
---
import keyring
ImportError: No module named keyring
@MisterMiyagi python -m pip install keyring
 
do you have multiple Python versions there?
 
python3 -m pip install keyring
Requirement already satisfied: keyring in /usr/local/lib/python3.7/dist-packages (21.2.0)
Requirement already satisfied: jeepney>=0.4.2; sys_platform == "linux" in /usr/local/lib/python3.7/dist-packages (from keyring) (0.4.3)
Requirement already satisfied: importlib-metadata; python_version < "3.8" in /usr/local/lib/python3.7/dist-packages (from keyring) (1.6.0)
Requirement already satisfied: SecretStorage>=3; sys_platform == "linux" in /usr/local/lib/python3.7/dist-packages (from keyring) (3.1.2)
python3 -m pip install keyring and pip3 install keyring both are the same.
@αԋɱҽԃαмєяιcαη No.
How can I check it?
 
that's too long to be pasted here. you can use dpaste.com if you want to share a long lines such as previous.
 
Only pip3 file on "bin" dir.
 
12:41 PM
So you've installed keyring into python3 and are running your script with python.
 
@Aran-Fey Yes.
 
run your code with python3 instead of python
 
Oh no!!!!
from urlparse import urlparse
ModuleNotFoundError: No module named 'urlparse'
 
oh no
 
12:43 PM
oh no, you wrote python 2 code
 
use from urllib.parse import urlparse
but make sure that you installed it too under pip3 where you will run it via python3
 
I don't know well about python3
 
it's about time you learned, then
python 2 is dead (yay!)
 
are we gonna spend another 20 minutes figuring out if the script is python 2 or python 3 now?
 
Oh yes! 3 < is reference for the version
 
12:45 PM
@Aran-Fey they mentioned changing to urlparse, so I bet most of it is 2 except for random edits done during this struggle
 
@AndrasDeak Yes!
import urllib
 
@AndrasDeak :D only today i started to know the keys of your sarcastic :P "yay"
 
Oh another error! Apologize friends, please help me.
---
from Crypto.Cipher import AES
ModuleNotFoundError: No module named 'Crypto'
 
google is your best friend from now on.
 
Thank you, may be ...
I think the python is the most powerful lang in the world, isn't it? :) bye-
 
12:48 PM
bye
 
See you soon. from beginner.
:)
My project is working well... thank you!
 
How I can set male voice in gTTS?
(google text to speach)
 
@LordOfThunder which python module are you using with it?
 
gtts module
 
oh, that's the actual module, sorry
Does google translate support that?
 
12:59 PM
I have never heard a male voice in google translate though
 
me neither
I just checked again and I can't easily find any settings for the voice, which would make it possible (if not likely) that the API doesn't support this either
but I'm just rubber ducking here
 
<mops brow> 3 hours of debugging via facebook chat including complete loss of my dashboard in the middle. Monday Funday. Sadly I can't go tell the head of I.T. that this is why I needed to train someone up, but at least it's fixed and the guy I've been training up on the sly did great :)
 
good job
or as an assignment expression would say, g'joob
 
why double o then
 
probably due to the teeth
 
1:03 PM
Poor walrus
 
hollywood smile isn't there :O
 
1:15 PM
in pandas, what's the difference between .loc and .at ? the document not clear about it. i think it's about the performance ?
 
> Access a single value for a row/column label pair.

Similar to loc, in that both provide label-based lookups. Use at if you only need to get or set a single value in a DataFrame or Series.
Seems clear to me
Loc supports slices and array-likes
 
Presumably you found this?
 
Just now I'm into that page.
 
And yeah, I bet .at has much less overhead
atand iat a meant to access a scalar, that is, a single element in the dataframe, while loc and ilocare ments to access several elements at the same time, potentially to perform vectorized operations. — ncasas Oct 7 '16 at 9:24
That missing space looks terrible in chat
 
at: get scalar values. It's a very fast loc well it's about the speed.
how you mention the answer directly here from a post?
 
1:20 PM
An answer? Click the "share" button and get the link. But what are you trying to do with it?
 
No, i mean the previous part which Andras shared just now
 
If you mean posting a quote, then it's clicking on the timestamp and copying the link in the browser
I'm getting deja vu :)
 
Sandbox
 
Wait, you were there
 
no it's not deja vu, before i asked about the url itself. now i asked about the quotation. thanks @roganjosh
 
1:22 PM
Ah, then just paste :)
 
Hoping for a comment link
 
@AndrasDeak yes that's what i meant. thanks both
 
2:11 PM
needs details / seeks external libraries stackoverflow.com/questions/61061470/…
 
2:29 PM
can somebody tell me what does this error mean?
https://pastebin.com/ri4aiTuB
 
You should read the bottom line of the traceback. What do you understand from that?
And that's a serious question; reading tracebacks is fundamental to being able to code
 
ImportError: No module named celery
 
ahh, actually i do read that
 
and what you did after?
 
@αԋɱҽԃαмєяιcαη I'm trying to make them figure it out themself
 
2:33 PM
@roganjosh alright, sorry for that
 
after that i was looking to learn what is clery
maybe i'm too exausted
i was actually asking where do see these module
like manage.py shows functions only
 
pip freeze will give you all your installed Python modules
 
okay in that list i see celery==3.1.18
it looks like its installed
 
Also note that you shouldn't be using Python 2 if you're just starting out. It's reached its end of life. So, unless you're running an existing project, it's a really bad idea
Ok, are you using a virtual environment?
 
yea i know, i'm using python3 and its working like a charm but i'm trying to figure out an old project
its on python2
 
2:39 PM
In which case, I suspect that celery is installed in Python 3 and not Python 2
 
but for python3 i would need to do "pip3 freeze" no ?
 
Not necessarily. But I'm not the person to be able to answer that one, sorry
 
alright, thanks for your input
 
Have you tried making a virtual environment to run this project?
 
yea
i am in venv
and i ran the requirement.txt succssfully '
this error is coming up when i'm running manage.py migrate
 
2:50 PM
Sorry?
You mean that you installed everything from requirements.txt and the issue comes from migrating the database? That doesn't seem right
 
yea it comes up when i try to run the manage.py migrate
yea it doesn't that's what i'm searching
 
Well then I'm definitely out of suggestions. I don't understand why celery has anything to do with database migrations
 
let me give a little more background then it might make sense
so first i was getting error on "MySQL-python==1.2.5" when install requirement.txt
then i skipped it, i think that is doing the problem in manage.py
 
So you just dropped something from requirements.txt and moved on to the next error without solving the first? That doesn't sound particularly wise
 
-_-
correct, stupid me
now i'm searching for that solution first
 
2:58 PM
Probably you just need to install mysql for your platform
 
hmm mysql-client is installed, the only package i can't see is MySQL-python
and i read that its only for python2
 
3:24 PM
Wouldn't it be nice if browsers ran Python just like they do JS?
It would be so cool if there was PythonScript, which would be like Python except with {}'s and ;'s
For minification
 
3:50 PM
Is beeware a transpiler system?
@MisterMiyagi and @roganjosh neat, how well do those work?
 
@AndrasDeak I haven't actually used it, I just remember the clock being posted. Also, I have in the back of my head that beeware is dead :/
 
github seems alive to me
 
I don't know whether that is true about beeware. But I think the transpiler libraries aren't working out so well
I assessed the landscape a few months back and determined that Kivy was probably the best library in Python, but I also tried React-native and settled on learning some Kotlin. I never actually built an app with any of them, so I'm more than happy to be told otherwise
 
@roganjosh Isn't Beeware the collection of libraries that the guy who keynoted PyCon last year works on? That detail alone would make me surprised if it had gone dead so quickly.
 
4:14 PM
I'm possibly wrong on that assessment but I also went massively off-topic with my last statement based on my own circumstances :/
Still, 2 issues and 1 pull request. That's not really traction
 
wim
How do I make "Take our short survey" banner go away??
@AndrasDeak brython is trash. don't know about pyodide but it looks to be barking up the right tree (wasm).
 
4:37 PM
what is the difference between a cache and a databse in the backend?
github.com/donnemartin/…
see diagram under "Index of system design topics"
2) in this diagram what do the squares underneath the sqaures for each service represent?
 
00:00 - 17:0017:00 - 00:00

« first day (3460 days earlier)      last day (1493 days later) »