« first day (3694 days earlier)      last day (1244 days later) » 

12:53 AM
I posted a gist of my leetcode solution for problem 207. Course Schedule, I'm not sure how to fix it I think the problem is due to the choice of starting node.
But I'm not sure how to fix it so it works if you start from any node in the graph. https://gist.github.com/erotavlas/064b63d2941725f0171e1c07ebe350cf
any help is appreciated :-/
 
 
3 hours later…
3:43 AM
Can I get the randomized value using random function and store it in a variable?
For instance, I have randomList = random.choice((a, b, c, d)) to randomize a words in a list. Can I store the element that will be randomized in a variable whenever the program is executed? How? tysm
 
@annyeongkre - The early suggestion about going thru a tutorial still holds - calling any function and storing its value into a variable is pretty basic stuff that you should get from any tutorial. But you should also get a good grasp on how to read and learn the application programming interface (or "API") that is presented to you by a module such as random.
random.random() - returns a float number in the range [0.0, 1.0)
random.choice(list_of_choices) - returns one of the items in the list_of_choices argument
random.randint(min_int, max_int) - returns an int in the range [min_int, max_int]
random.shuffle(list_of_items) - rearranges the items in list_of_items in place

These and more at https://docs.python.org/3/library/random.html
In your sample code randomList = random.choice((a, b, c, d)), what are a, b, c, and d?
 
functions, for example
 
Assigning the value returned by random.choice to a variable named randomList implies that you expect to get back a list.
 
4:01 AM
for example when I clicked on a button and I wanted to get the element stored in randomList AFTER being shuffled and randomized, then this will work? by just calling randomList?
How will I call whatever is the value stored in the randomList, where the values are functions?
 
This is going to take a while - let's use a different room, and not belabor in this chat.
 
where
 
@annyeongkre - there is a new room here: chat.stackoverflow.com/rooms/225138/…
@annyeongkre - I opened that room 10 minutes ago, are you not going to want my help?
 
4:42 AM
What is this
Litness
 
5:31 AM
omigosh omigosh omigosh
cross join is finally coming to pandas in 1.2 ------- https://github.com/pandas-dev/pandas/pull/37864
 
 
3 hours later…
8:07 AM
@cs95 about time
 
hey guys quick one I have reset this up now that I have the next laptop and when setting the stmp mail config and running tests i keep recieving this: smtplib.SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 support.google.com/mail/?p=BadCredentials l24sm7672279wrb.28 - gsmtp')
I am not quite sure why as I have triple checked the username and password details I am setting here
MAIL_SERVER=smtp.googlemail.com
MAIL_PORT=587
MAIL_USE_TLS=1
MAIL_USERNAME='username'
MAIL_PASSWORD='password'
ADMINS=['email@example.com']
 
meta is a very weird shadow realm of so, ppl there just seem odd
@Kwsswart maybe the pw is getting changed after being defined? Maybe it's used wrongly there where it tries to pass it to the server
 
@Hakaishin thats what I thought but when printing it in the terminal through os.environ.get it comes as expected and this was working well previously before having to change laptops so I can only figure I am doing something wrong here -,-
 
run it in the debugger and set a breakpoint right before where it's getting passed to the server and check the value there
 
hmm will do
 
8:21 AM
"Allow less secure apps: If you don't use 2-Step Verification, you might need to allow less secure apps to access your account."
when I used gmail from python I had to use this option
 
@python_learner ah yes, good point
 
I was about to suggest that using my own words, but it is in the page that is linked
I guess gmail has its own library to send mails that doenst require messing with this, been a while since I did that
 
@python_learner I have allowed it but judging from the error I am assuming it comes down to the login credentials which is a pain as I they are right so just gno try view them at different parts maybe I will find where it is going off :/
 
I will see if I still have the code I used, will @ you if I find something useful
to the devs here, is it unrealistic of me to expect pure python only jobs? most listings ask for Data Science, ML stuff, and honestly I am more interested in jobs where they say I want this app do this, is that not how it works?
not to mention flashy words like AWS, DevOps
 
@python_learner yes, mostly. Jobs are by it's nature fuzzy. Otherwise companies would just buy the thing they want. That is the reason why people are hired, because it is inherently not 100% sure what they will do and not too well defined, otherwise they could just contract it
@python_learner that sounds more like you are looking to do a freelance job, not searching for a job
 
8:32 AM
not really, I just feel comfortable doing something when I have control over it, in my internship I had "Senior" devs come and micromanage all code I wrote, even criticized an answer (I used this in my code) that had like 250 votes on SO
 
What is the modern way to do ajax calls to a flask url to update the contents of a table? I feel like ajaxs was replaced by some newer things, but I'm not sure.
 
8:46 AM
@python_learner Python is a means to do things. Doing things relies much more on design/domain knowledge than language knowledge. Unless you just want to transcribe a spec, being able to do the (basic) planning on your own will be a requirement for many jobs.
 
that clears some of my thoughts, thanks
 
cbg
 
9:16 AM
@python_learner must have been getting the information wrong because when creating a new account then using those details seems it works again.. obviously need to work with it more and nail it to work perfectly
 
I did use an alternate account
not because of the error, I just didnt want to end up banning my main gmail
 
 
2 hours later…
10:51 AM
hello
59
Q: Finding common rows (intersection) in two Pandas dataframes

David ChouinardAssume I have two dataframes of this format (call them df1 and df2): +------------------------+------------------------+--------+ | user_id | business_id | rating | +------------------------+------------------------+--------+ | rLtl8ZkDX5vH5nAx9C3q5Q | eIxSLxzIlfExI6vgA...

is there a anyway to acheive whats done in the second method at the bottom?
in a fewer lines of code
 
@FĂ©lixGagnon-Grenier Great. My interaction with SO has decreased by 99% and my quality of life has increased accordingly (:
12
 
11:11 AM
you said it
my answers are answering questions for me, so I don't have to
 
11:56 AM
is there any light weight GUI library for python?(when i convert it to exe it shld not be huge or take more than 10mb for just a hello world)
 
there is tkinter, don't know about anything else. I use flask to make guis, it has the nice advantage that you can turn it into a website later if you want and also that it looks decent on mobile without you having to write an app
 
can i convert it into exe?(the flask one) and does it take more than 10 mb for just a hello world?
 
you can with pyinstaller, but I don't know if it will be less than 10mb, which also seems like a ridiculous requirement nowadays
 
well its because it shld be as light as possible so, i will check flask and see how it does
 
@Praveen why?
 
12:05 PM
according to you what size should it be?
 
According to me you shouldn't care. What you want to do is called premature optimization
 
Hi,
I asked a question on stackoverflow but no one answered. May I share the link ?
 
@KamrulHasan If it's older than 48 hours, sure you can. If it isn't & you want some feedback on the question itself (phrasing, MVC, etc.), you're free to request that as well.
 
12:22 PM
It's older than 48 hours.
Here it is. Please have a look.
https://stackoverflow.com/questions/64971689/raise-attributeerror-response-content-isnt-text-scarpy-proxy-pool-how-to-solv
 
1:05 PM
Is there a way in this function to only test if foo is 3 and bar 42 in a unittest? Using unittest not pytest
@app.route('/')
def hello_world():
    return render_template("main.html", foo=3, bar=42)
I don't want to have to parse the html but only test if the data is correct. I saw this: flask.palletsprojects.com/en/1.1.x/testing but it uses Pytest and I would like to keep my testing consistent and thus I would like to use unittest not Pytest
 
1:16 PM
I suppose you'd have to mock render_template
 
morning cabbages, folks
 
How do I connect one python file to run to another?
 
import
 
@annyeongkre stop right now.
 
lol
 
1:22 PM
@annyeongkre You were told to read a tutorial before abusing the time of the people here. Then you kept asking here, Paul offered his time to help in another room. You ignored it entirely, and came back asking again. This does not work. You must change your behaviour.
 
didn't ignore it though
we talked already heh
 
@annyeongkre ah, I'm sorry, I misread your chat history, sorry.
 
fyi: googling "python code multiple files" gives me about 2 * 10**3 results of tutorials of what you want
 
@annyeongkre so let's just stick to: please read a tutorial before asking here.
 
import win32com.client as win32
excel = win32.gencache.EnsureDispatch('Excel.Application')
wb = excel.Workbooks.Open('Inputs.xlsx')
 
1:31 PM
after importing, how would I call the entire file without calling a specific function in the file? tried it already though but not working
 
@annyeongkre your question doesn't make sense
 
the very act of importing in fact, executes all the code in the file being imported
 
i mean, i imported the file already. I wanted the imported file to be executed after a specific function of my file, how will I do that? how will I be able to call it?
 
put all the code in that file inside a function in that file. Then call that function whenever you want
 
import fileA

fileA.main() -- like this?
 
1:35 PM
yup
 
@AndrasDeak melons
 
need more sleep for this
 
@Aran-Fey For a moment I read SO as Significant Other rather than StackOverflow. Got worried & then subsequently relieved that I'm somewhat in the same boat :D
 
I tried that already but in my second file, I also imported another file and didn't read it because it is inside a function and it gives me error which says unresolved reference
 
can you please get rid of python in my garden??
 
1:45 PM
Garden
 
@Praveen Sure thing
In [29]: garden
Out[29]: ['plants', 'grass', 'flowers', 'python']

In [30]: garden.remove('python')

In [31]: garden
Out[31]: ['plants', 'grass', 'flowers']
 
Thanks :)
 
@shad0w_wa1k3r I have included traceback to the question as you suggested .
 
import win32com.client as win32
excel = win32.gencache.EnsureDispatch('Excel.Application')
wb = excel.Workbooks.Open('Inputs.xlsx')Why the third line doesnot read my file "Inputs.xlsx" existing in the same location where the script is running but if I put complete path then it works. Can anyone kindly help in these?
 
Your current working directory doesn't necessarily have to be the place where the code is placed.
So, here your current directory is probably different.
 
1:57 PM
But if put df = pd.read_excel("Input_Details.xlsx") it works
Both are in same directory and working directory is same
 
uh
then your issue is something else (probably), and a traceback would help.
 
Seems safe to assume that Excel has a different working directory.
 
@Aran-Fey May be, do u know how to figure out the working directory of Excel?
 
Do you get an error when opening the file, or does it create a new file? In the latter case, you could use the Explorer to search for the file.
 
No I dont think there is any error in file, Same filename can be opened using Pandas read_excel() but fails with excel.Workbooks.Open() in the same script
 
2:12 PM
what does "fails" mean here?
 
com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Excel', "Sorry, we couldn't find Inputs.xlsx. Is it possible it was moved, renamed or deleted?", 'xlmain11.chm', 0, -2146827284), None)
This error arises
 
Okay, now just to double check, is the file named Inputs.xlsx or Input_Details.xlsx?
 
It is Inputs.xlsx , (before It was Input_Details.xlsx). I edited to make a short file name. But still doesn't work out
 
python code gets converted to C right? that is why it is called as the interpreted language right?, how can i get tht c code ?
 
Python code isn't converted to C.
 
2:22 PM
then?
 
The CPython interpreter is written in C and compiled to a native executable. There is no C at runtime.
 
And code being converted to a different language doesn't have any bearing on being interpreted or compiled. that's a separate concept on its own
 
The CPython source code is available on github.
 
then why is it called interpreted?
 
Because the CPython executable interprets your Python code.
 
2:25 PM
ohh i get it, its like not exe as C converts it directly to exe, hmmm
 
Actually, I wanted to read an excel file preserving the format of the content(like subscript and superscripts) in which Pandas read_excel() could read only the plain text. Then I found "excel.Workbooks.Open()" can do the job. But this is not able to read file present in its working directory
 
@Suresh Is there any reason why you don't just use the full file path to open the file?
This could save you a lot of trouble.
 
@MisterMiyagi I am developing a tool where the script reads the excel file present in the same directory so that end-user doesn't have to bother about providing the full path of the file.
 
That's nice, but it doesn't answer my question.
 
So If i put the full path of mine, it wont work in other PC as the Path wont be same
 
2:29 PM
Are you aware that you can use __file__ and os.getcwd() to get the script path and current working directory, respectively?
Or for that matter os.path.abspath/pathlib.Path(...).absolute to convert a relative to absolute path?
 
Thats a nice idea, I had done once. Let me try
Thanks, I think that will work.
 
@Praveen Don't think you've quite got it yet. The interpreter converts your program into bytecodes (which are stored in the .pyc file), and then "interprets" the bytecodes by emulating an imaginary Python Virtual Machine. The dis module can show you the bytecode for any program text.
 
Yea, Finally It worked. I extracted the os.getcwd() and append my filename to create a final path of the file.
 
@holdenweb yeah i got it
 
3:09 PM
in other news, I can't work because my typing speed is absolute garbage because the office is at 14C today
 
all the more reason to type fast? :p
 
unfortunately, I didn't catch on early enough. So my hands have frozen and refuse to move fast enough to generate that kinda heat
 
anyway... what's wrong with 14C - that's about right for a temperature... anything warmer than that and I feel tired :)
 
I sir, am built for the tropics. I'm sure a Hothian programmer wouldn't mind these temperatures, but I'm freezing my tail(-recursion) here
 
@JonClements What!!!!
 
3:19 PM
@Praveen he's being very sarcastic
 
yep
 
@inspectorG4dget Well... 1) I'm British - so it's inevitable...but 2) that really is a reasonable temperature for England :p
(20C is hot!)
 
@inspectorG4dget that's like arctic temperatures right there
 
@JonClements wat?! that's a labor law violation in Ontario, Canada. Offices in South India (where I'm from) are air conditioned to no lower than 22C because people start complaining about the cold
 
3:33 PM
i guess i am unbanned from asking questions on stackoverflow
 
@Praveen it would appear so... but as you were question blocked... make sure that if you do ask a Q it's the best you can make it, otherwise you'll fall back into a block again if it's negatively received etc...
 
@JonClements i am going to ask questions here in this chatroom rather than posting it on stackoverflow
 
@Praveen as long as you stick to the rules... you shouldn't be afraid of asking a Q on main... it might well be asking some things here (within reason) can help you formulate a decent Q to ask on main etc...
 
ok :)
 
cabbage
 
3:53 PM
cabbage
 
4:22 PM
Anyone here that can help in deciding whether is needed as a new tag: meta.stackoverflow.com/questions/403170/…
 
eek... the blurry flower is here... everyone hide... pretend we're not in! :p
@rene in principle I don't see any harm with that, but would need to check the current posts - plus it'd need a decent tag wiki etc...
 
Yeah, I was trying to make the OP write that excerpt and wiki but they selectively read the FAQ ;)
 
at least reading something is better than most do at times :p
 
4:41 PM
true that
 
 
1 hour later…
5:51 PM
@rene intruder alert!
 
wow... it's definitely homework day in the python tag...
 
6:07 PM
@AndrasDeak take cover!
 
6:33 PM
@JonClements Exercises in this semester have been going for about 2 weeks around here. Perfect time for frantically seeking help after dozing off in the first week.
 
 
2 hours later…
8:10 PM
@JonClements well, python's popularity is unstoppable, so even more people than ever are picking it up it seems
 
 
2 hours later…
9:57 PM
anyone here familiar with lstms by any chance?
 
10:21 PM
I wonder if I've just been blind/rushing for something else in the past, but this now gets printed out when you do print(globals()) in Spyder. Seems an odd place to put it
 
10:36 PM
I usually see that printed with gc.get_referrers()
probably tied to some auxiliary thing that lives in the REPL
@roganjosh just to be clear I'm talking about this
@E.Oak you can stop talking about this now
 
Interesting. So it appears in the garbage collector, and in globals in Spyder. Good branding :P
 
Well with the gc output it's probably a value in a dict. I just never bothered to check what dict that is.
 
@roganjosh You are thinking of Py2.x, which put the .pyc files in the same directory. Py3 now puts them in a __pycache__ subdir of the current directory.
 
@PaulMcG Ah, indeed, thanks. I was also thinking of Enthought Canopy that had some ... unusual... tracebacks from its cached modules. In any case, I don't think there's headway to be made with that particular problem
 

« first day (3694 days earlier)      last day (1244 days later) »