« first day (3697 days earlier)      last day (1234 days later) » 

2:38 AM
Netlink sockets are working in python ?
 
 
5 hours later…
8:00 AM
Hi
I am trying using pygifsicle module to optimize my gif, but it says that path is not found, even though it exists.
>>> from pygifsicle import optimize
>>> optimize(r"D:/poll bot/bot/bot/revive/junk/W13KNII9MQ.gif")
Traceback (most recent call last):
  File "<pyshell#14>", line 1, in <module>
    optimize(r"D:/poll bot/bot/bot/revive/junk/W13KNII9MQ.gif")
  File "C:\Users\MN\AppData\Local\Programs\Python\Python39\lib\site-packages\pygifsicle\pygifsicle.py", line 64, in optimize
    gifsicle(source, *args, **kwargs, optimize=True)
  File "C:\Users\MN\AppData\Local\Programs\Python\Python39\lib\site-packages\pygifsicle\pygifsicle.py", line 52, in gifsicle
 
8:51 AM
@BlackThunder did you try renaming the "poll bot" folder without spaces
 
9:11 AM
@BlackThunder It's telling you that it can't find the gifsicle executable
 
10:04 AM
Has anyone on Windows started having issues with the latest updates? My laptop keeps restarting overnight but it gets locked in a cycle that won't finish the restart. I'm not a fan of the hard restarts :/
 
since a year or so
 
Ugh, I've been "lucky" then. The only thing the latest update seems to bring is trying to suck in more of my life into the MS world. It's not feeling like this update is worth the stress; I'd be a little more sympathetic if they could tell me which horrifying back door they've closed in the recent update
 
not a fan of updates either, the new macOS update made it look more like a phone now :/
 
Used to use Windows a lot. The company gave me a Windows laptop a year ago which has been switched on for a total of maybe a week.
 
@python_learner At work everyone is on a mac and I've seen all the nonsense going on in our Slack channel with the latest update so I'm holding off on that one
 
10:17 AM
Everything will look more and more like 'phones - mobile is rapidly becoming the majority UX. We'll by trialling our VR science classes on mobile next year ...
 
that is so true, the local "PayPal" alternative in India wont even let me use the browser login on a desktop without a mobile app
 
And WatsApp on Mac requires to be in contact with my 'phone!
 
Equally, my bank wouldn't let me update my address recently over the phone. It apparently required a higher level of security and so I had to install their app. Given that there was no 2FA on the app, I can't really work out why that is considered a higher level of security. I've actively tried to keep my phone as distant as possible from my banking
 
@holdenweb and less and less like phones!
 
Anyone know the Python type of a JSON value offhand?
Could be: dict, list, number, string, None, boolean, ...
... and doubtless others I am overlooking. Though I might in this case just get away with dict, I guess.
 
10:27 AM
I think that's it
Even custom serialisers are likely to go for one of those types. If we're both missing one, I don't think it's going to be a common thing
 
So the Union of all those types? (gulp)
 
Im using flask login manager for loging user in, and `@app.before_request decorater to set the session timer to 2 min, so the session expires after 2 minutes if no request
the effect is that the user is logged out, but I dont understand why , the function does not redirect to the logout view
is there some internal stuff going on ?
 
@holdenweb In reality, the outer container will usually be a dict but occasionally a list, though?
 
Indeed, I was coming to that conclusion myself. Good enough for the likes of me, anyway.
 
10:37 AM
I don't know whether null is actually valid JSON on its own. Hmm, I could probably test that
@real_hagrid you'll have to be a lot more specific I'm afraid
Oh, I don't need to test it; someone already asked
"hot debate today"... back in 2011. I'm behind the times :/
 
Sure it's valid: try print(json.loads("null")) - it prints None
 
It wasn't always, though, according to that answer. "RFC 7159 drops the limitation that a JSON text must be an object or an array. "
Unfortunately, I suspect that's bad news for you because before that, you could be assured it was going to be a dict or a list, but this creates weird corner cases that'll probably never darken your doorstep but nonetheless exist
 
@real_hagrid Are you also setting session.permanent = True? Of course there's "internal stuff going on" - I believe sessions are handled in middleware, which wraps the view function.
 
@holdenweb im using this function to set a timer for the session
@flask_class.before_request
def make_session_permanent():
    if current_user.is_authenticated:
        session.permanent = True
        flask_class.permanent_session_lifetime = timedelta(seconds=6)
        session.modified = True
 
What's the relationship between 6 seconds and 2 minutes?
 
10:52 AM
i id change it to go faster, my route is protected with @login_required decorator, what I dont understand is how flask logs a user out if the session expires
I have a logout function but no redirect to that function if the session expires but it still works
 
Because the cookie expires
 
I understand that but which function logs the user out if the cookie expires
 
None. The is_authenticated check fails, I'm just trying to find it in the source code
Well actually, what is the observed behaviour? Do you get an automatic redirect to the login page?
 
yes I use login_manager.login_view = 'login' for redirect
 
Ok, so if the user does nothing and they leave your tab open, would they come back to see the login page or would they be redirected to the login page on their next action?
The latter is perfectly cromulent. The former requires some magic that I don't think exists in flask-login by default
 
11:11 AM
@real_hagrid If the user does not present a session cookie, the server has no records to associate the request with any prior requests, so it treats it as coming from an unknown and unauthenticated user.
I remember when we were using flask heavily at Felix we discovered that Flask session handling wasn't quite as straightforward as we thought, but all that code is archived.
 
Just about everything in that code snippet we've been given is also confusing me
I think that the latter scenario I presented is what happens, and the redirect will happen on the next action, rather than some automatic redirection at the expiry time, which I think would involve some kind of callback
@flask_class is unusual, though, rather than @app. I wonder if they're retro-fitting an app to some project
 
11:37 AM
A little research reminded me - the issue we failed to take into account was flask'-logins "remember me" features, which IIRC are independently timed from the session login but act similarly in that activity should extend it. I was reminded of this by bonser.dev/flask-session-timeout.html
That should at least clue you in to the relevant issues.
 
11:57 AM
My friend has a homework question that I am not understanding completely.
"Find a minimum of 2 sources (links) with prices for cloud rental for small businesses, preferably software and device rental (comprehensive package)."
What does it mean to have both software and device rental in a comprehensive package? Aren't those 2 exclusive? As in IaaS vs SaaS, or am I misunderstanding?
 
What course is it that sets that as a problem??
 
"Web technologies" course lol
In a business-oriented college type of thing
 
The closest I can think of on the device side is the limited number of registered devices that can access the service. But I'm with you; I'm pretty confused by that
 
I think it's trying to talk about IaaS sort of thing, but I'm not sure
At least I know the question is ill-formed. I'm just going to give her a link to DigitalOcean and similar services or something
 
Maybe something like AWS where you can spin up new instances for load-balancing
I can't remember which of the bajillion services they have that's applicable. But you can get clusters to scale up or down in size
 
12:11 PM
Yeah, thanks. :) I thought it's just me not understanding the question.
 
I think there's a few like that. Once you dockerise your tech, it can automatically spin up new instances. Kubernetes. I'm just throwing words out because I'm not sure how I'd pin down the links they want, exactly
Particularly because I'm not sure kubernetes == "device"
 
Yeah, I think mentioning "device" is ill-formed and shows incompetence of the asker. That's my opinion anyways.
 
I think you're going to have to report back on how their answer gets marked. At this rate, I'm failing my Web Technologies exam :/
 
Will do. Yeah, same. :P
 
<stares blankly at the point on my wall reserved for the certificate in Web Technologies>
 
12:25 PM
Lmao
You'll have to do some woo-doo magic to conjure up words and stack them into sentences that make sense to the asker.
 
yo guys
my first time writing classes, should I expect something going wrong when I make a for loop creating instances of the class with the same name but different arguments each loop?
 
no, that's perfectly fine
 
awesome, thanks :)
 
(assuming the "name" refers to the variable, because instances don't have names)
(unless you give them one... by assigning them to a variable)
 
yes, variable :)
 
12:50 PM
Aran, what about this?, which is similar:
https://pastebin.com/0E7d9ttU
(it's a scipy.differential_evolution call, not a minimize, actually)
 
constraint = constraint(y) feels wrong to me
 
I'm sorry I'll edit it
 
now it's fine
 
Is it? The append is out of the loop?
 
it is inside the loop
 
1:00 PM
Hmm, it's displaying weirdly on my mobile then
 
you scared me!
thanks guys :)
aran can you give some reference/doc to understand why is this working? because as a complete noob I'd imagine each time the loop happens a new instance of the class would be created, deleting the prior: the final list would then contain 3 equal calls to the same function, refering to the same instance (the last one)
 
which would you think is comparatively easier to learn and write code for? graphs or backtracking?
 
So if you see this code, you would expect the list to be [2, 2, 2] at the end? Is that right?
for x in range(3):
    my_list.append(x)
 
Purely from a interview standpoint and for graphs I am not looking into networkx
 
Deleting the prior one? You mean it will be unreferenced, and therefore garbage? But you are extracting a reference to the function while each instance is referenced by newConstraint.
Thereafter, you don't really care what happens to the instance: you're done with it.
 
1:08 PM
I see guys! I was thinking to "keep" a reference to the function on the manner it was build, the reference would need to "pass through" the class instance, and wouldn't be able to reference directly. I get it now!
this is actually great :)
 
Yeah, python doesn't remember that you got this function from a constraint object. It doesn't matter what happens to the constraint object, python only looks at the function
 
1:32 PM
Isn't the object preserved in that case, since it has a reference via that method?
 
@BožoStojković I only see a method call
 
Ah, I didn't see that. The discussion kind of confused me.
 
I assumed that the method call returns a function. Maybe that wasn't a great move
 
it might
 
1:53 PM
That was probably sue to my misstatement above, sorry. Of course, once the (class?)method has been called the function reference disappears.
 
2:04 PM
unless the return value holds a reference ;)
 
etc., etc. ...
 
2:39 PM
Is there any way to annotate the sequence of values yielded by a generator?
 
Shouldn't a generator's yielded values be the important thing? Which is to say, I wouldn't be surprised if the return type annotation referred to the type of yielded values... but I know nothing about typing
 
There's typing.Generator, if that helps
 
neat
Generator[YieldType, SendType, ReturnType] does seem helpful
 
AAB
Hi all,
I am facing an issue in scrapy I have made the following script(pastebin.com/eGLnWhau) to run each spider as a separate process create json file, log file under specific directory. The problem is I keep getting module ModuleNotFoundError: No module named
I have even set cwd field in subprocess.Popen() but I continue to get the error
my script in in the same directory as the .cfg file.
 
@AAB it would be a lot more convenient if python told you what module was missing. Too bad.
 
AAB
2:49 PM
@AndrasDeak Its missing the project module as in the one where I have created all the spiders etc..
if I run scrapy crawl from the command line it works fine.
File "/mnt/spiders/pcpartsspider/venv/bin/scrapy", line 11, in <module>
sys.exit(execute())
File "/mnt/spiders/pcpartsspider/venv/lib/python3.6/site-packages/scrapy/cmdline.py", line 114, in execute
settings = get_project_settings()
File "/mnt/spiders/pcpartsspider/venv/lib/python3.6/site-packages/scrapy/utils/project.py", line 69, in get_project_settings
this is what gets printed
 
that and a bunch of other things
 
AAB
3:16 PM
settings.setmodule(settings_module_path, priority='project')
File "/mnt/spiders/pcpartsspider/venv/lib/python3.6/site-packages/scrapy/settings/__init__.py", line 287, in setmodule some ENVVAR is not being set
 
AAB
3:35 PM
@AndrasDeak thanks it's working now, after settting the envvar I just panic when I see errors. :|
 
Did the envvar involve a cwd or the path to your script?
 
3:53 PM
Hi
Is there any Jenkins plugin for pylint results?
I know there was used to be violations plugin which is now deprecated. is there any alternative?
 
@Aran-Fey [returning from baking] it most certainly will. I'm kind of being dragged into typing somewhat reluctantly, but my enthusiasm is slowly building.
Anyone want a banana nut muffin? Not veggie, I'm afraid.
 
@holdenweb yumm
 
AAB
4:25 PM
@AndrasDeak it reads a vlaue from the .cfg to the settings.py file
 
4:50 PM
I have data like this https://dpaste.org/ZsRD
saved in an array,
somebody please suggest how do i save it so that it would be easy for me to read it too,
right now i can't do anything of it

maybe what's wrong here is that i haven't put "," comma ?
 
@AAB Please do note, however, that while you may be scraping in separate processes those processes are running one after the other, which is only going to slow things down :-(
@HabibRehman "saved in an array" means what? In a list in your program?
 
yes list in my program
i am trying to collect the data at one place and then use it, as you may see there are nested list and objects with keys
 
For a list of dicts, as long as the keys are all strings the natural way to store this is as JSON data. Are you familiar with that?
 
yes familiar with JSON
i am unable to see it as index, like for 0 index i want to save an object
let me show you how i'm doing it
 
OK. So the json module has functions to load and store (with files or strings) such values, and it's quite easy to render them (somewhat) readable. Lists are among the objects you can save and restore.
>>> import json
>>> json.loads(json.dumps(['banana', {'cat': 'feline'}, 1, 3.14159]))
['banana', {'cat': 'feline'}, 1, 3.14159]
As you can see, such data structures round-trip correctly through JSON and you get back the list you first thought of.
 
5:03 PM
ohhh, let me try that. many Thanks
 
As to "i am unable to see it as index, like for 0 index i want to save an object", I don't really understand that. I'd suggest first off your undertake simple experiments: save a complex object as JSON, read it back, modify it, write it out again. Get confidence with operations line that first.
json.load and json.dump are similar, but they work with a file opened for reading and writing respectively. Also note that the default format is compact, but that the "indent" argument makes is much more readable without changing the value.
Also, remember I'm a crappy typist ;-)
 
Don't worry about typing.
I am trying my json dump as you have explained. I got the idea what you are saying
 
Cool. One small step at a time. The interactive interpreter is your friend.
 
yes i always forget that "one small step at a time" , thanks
 
5:21 PM
Mastery in one small area is a much better foundation for progress than systems of complexity beyond your understanding. No worries, happy to help.
 
5:51 PM
:)
 
AAB
6:10 PM
@holdenweb I am using scrapy crawl spider_name -o --logfile options I am not sure how can I use that in thread.
since I am running a command dont I have to use subprocess?
Is using thread here possible?
if I dont do p.wait() the process should all work parallely right why will it make things slower?
 
 
1 hour later…
7:21 PM
Hi all
I'm making a program in Python
But orange arrows don't reach the white axes when rotated
If anyone can help, that would be great
 
presumably your coordinates are off
Do you really expect someone to look at that figure and tell you what's wrong?
 
Here's the code: bit.ly/36fIBNc
 
mhmm
Why do you have things like radians(degrees(atan(s.value))) in there?
 
That converts the velocity (last slider) into an angle. That's the angle by which the white axes rotate. The radians converts from degrees to rad.
 
What units does atan return?
 
7:29 PM
@AAB I don't think I fully follow the discussion but threading is not necessarily faster in python due to the Global Interpreter Lock (GIL) unless it's around things like I/O
 
s.value is a decimal (i.e., 0.6); atan(s.value) = number, and that number is just some angle
That's the angle by which the white axes rotates
 
@DarkRunner angle in what units?
 
Angles can only be in degrees or radians; I believe it returns in radians.
 
Well no, there are also gradians.
 
Right, but VPython doesn't support that, and this program doesn't use it
 
7:32 PM
So when you do radians(degrees(atan(...))) you are doing two unnecessary steps, right?
 
Hmm, that's a good catch
Let's see if I remove it and it still works ...
 
I'd want to have a stern talk with VPython devs if that's anything other than a no-op
 
You're right, it is 2 unnecessary steps
I just removed it, and it works just fine
Nevertheless, the problem is still there
 
well, yeah
 
See, it's almost like it's just short of reaching the axes
 
7:44 PM
A single screenshot of a complex 3d scene tells me nothing. But it doesn't seem that close to me.
presumably the axes are defined by an equation; check if the true ends of the orange arrows satisfy the equation
without an MCVE I won't start disentangling that
 
8:01 PM
Right
 
8:20 PM
HI guys was wondering about this
rand = 15
var = 3
randvar = 4

if rand or var or randvar == 0:
    print('No')
else:
    print('Yes')
Here it will print No. Does that mean the if statement is checking if rand is True or var is True or if randvar is 0 ?
I know the right way to put this is like if rand == 0 or var == 0 or randvar == 0: But I wanted to know how python evaluated it.
 
What you're potentially asking is about truthy values
 
truthy means statements that are True right?
 
Non-zero integers are True in the sense of truthiness
 
integers here was just an example, i was thinking about how python check the first if statement.
 
cbg patch
 
8:24 PM
rand is an integer other than 0, so if rand or.... doesn't care about the next checks. It found a truthy value
 
Oh a loophole in my example.
Anyway basically, python is checking if rand is True or not right? Same with other variables
 
Is it? I mean, this is a well-trodden path in Python and your example seems to fit the common dupe
 
@CoolCloud not, it's checking whether bool(rand) is True
 
@CoolCloud it only gets as far as checking the first value
 
@Aran-Fey Yeaa got it! I was just wondering how python evaluated it. Thanks !
@roganjosh Yeaa realized that now, thanks mate !
You guys can clearly see, im still a beginner, and i dont know if i should just start another language or just pursue python.
 
8:30 PM
I'm not sure that changing languages based on the fact that you're facing some difficulties here is a good idea. But, hey, it's totally up to you
 
yea that seems like a nuclear option
 
Im not facing any difficulties yet, and I think its because the basics of python is very easy. But im not having the opportunity and time to go on to the real stuff.
@Skyler xp
 
i mean occassionally ill switch from python to R because sometimes its just a lot easier to do certain things
 
@CoolCloud well you're in luck, advent of code starts in two days
5
so lots of opportunity to learn
 
but thats just for niche data science things
 
8:33 PM
@Arne lol just hearing it for the first time. Its a competition? Winners get prizes or something?
 
See, I just can't get my head around R. I'm actively re-tooling the company I'm at to avoid having to use it
 
nah, winners get to learn how to program. which is, honestly, the best prize
8
the goal is the skills you gained on the way, and all that
 
By opportunity I mean time too, being in school sucks because have to cope up with the school work and python of school is just basics and the rest is libraries like pandas and matplotlib graphs.
 
@roganjosh its just a bunch of malarkey, treat it like some kind of endpoint that you just use to look at something and run away from any applications that require you to understand how to interface with it
its just too weird
 
is R harder than python?
 
8:35 PM
It's different. And it's different to general programming languages
 
its for doing statistics really
 
ooh i was planning on pursuing software engineering later on. Im on my last year of high school. And im not a fan of statistics, are there a lot of that in software engineering?
 
its more so coming up as part of data science and machine learning
 
I think I have a compelling example to pull people out of using Shiny but I haven't yet found a nice replacement for Rmarkdown to make the PDF reports
 
@Skyler Oh yes.
 
8:37 PM
id say in 5 years though the likely shift is going to be that many ML jobs will be software engineers who also have some stats experience
 
Which language do you guys think is important and easy too.
@Skyler I have to start loving stats then xp
 
python easily
I would recommend taking a C++ class though because it is hard, and forces you to think like a computer
 
Heh. I think that might be more painful than it's worth
 
absolutely essential for becoming a competent programmer (the thinking like a computer part), and the world is built off C++
 
@Skyler Yea ive been thinking too . Maybe using C++ will get me more undestanding of a computer.
@roganjosh Yea??
 
8:39 PM
Good C++ code has little to do with a computer
 
@roganjosh I mean at least you dont have to start at assembly these days
 
C++ is known to be very complicated. It's super-fast if you get it right, but I'm not sure it's ideal for understanding hardware
 
@AndrasDeak but im saying become a C++ programmer, it's just that the language is very much a middle level language in a sense compared to high level stuff like python
 
What was the language of a computer? Assembly right?
 
Or whether it's a good model for people to follow to become good programmers
 
8:41 PM
@roganjosh Oh, I see.
 
assembly is like a one to one mapping of machine code, so in a sense yea
 
@CoolCloud binary? I mean, everything is an abstraction from there
 
@roganjosh 0s and 1s right?
 
@CoolCloud idk, in my cohort of like 120 grad students I'd say that almost everyone who knew just python couldnt really program beyond scripts
and that a lot of time they tripped up because they werent really ever forced to think like a computer
 
8:43 PM
python alone isnt much of use i guess, combination of languages might be the key?
@roganjosh Just 1?
 
they never had to think about typing and actually what a computer does when it creates an int or float
lots of them would get sloppy about passing data structures and wonder why their code was breaking
 
Oh i see.
 
@CoolCloud are my binary answers not sufficient for you? :P
 
@roganjosh Oh you were answering in binary, god xp
 
8:46 PM
i think its good for everyone to learn how a computer is a high speed moron, and having dumb trip ups for a semester in a C++ class is usually a good pill to swallow
 
Maybe ill try c++ soon, given im done with my exams soon. Its just all hard in here to study other subjects and focus on python at the same time.
 
watch out for missing semi colons and doing = instead of ==
they will drive you insane for a bit
 
Im past the stage of being confused for == and =, thankfully. But where do you use a ; ?
 
in C++ that indicates a line break
 
@CoolCloud you're in for a surprise
@Skyler eh
 
8:50 PM
well
 
nevermind, I won't get involved :D
 
you know what i mean andras
whats a better way to put it
 
@AndrasDeak TBH i havent used ; in python yet, like ever
 
not a line break
 
Ive heard it is used in the end of statements, like lines? To show that the next line has begun?
 
8:51 PM
yea,
end of statement was the term i was looking for
 
: p
 
@CoolCloud one last remark: if you do end up studying C(++): step 0 is forgetting everything about python.
 
@AndrasDeak Whaa, why? lol
Its gonna drive me crazy, isnt it xp
 
because python is like riding a tricycle by comparison
it holds your hand through a lot of things
 
and i assume c++ is unicycle ?
 
8:54 PM
such as dynamic typing
eh, C maybe
assembly is just trying to stay balanced on a ball
 
lol
 

« first day (3697 days earlier)      last day (1234 days later) »