« first day (3754 days earlier)      last day (76 days later) » 

1:20 AM
@roganjosh yeah I have been getting some db locked errors lately, wanted to take all steps I can to avoid that
it actually turned out that my cron script interval was so low that the previous script was still running when the next job gets triggered and hence the error, or that is what I have rounded it to
6 hours later…
7:05 AM
cbg fellas
I am doing a query on plastic with python, gathering a big query, data stops at some point, I think it is getting cut at some point(because query stops at some point like in the middle of the query), how to get the data from plastic like channeling or part by part?
Do I getting limited by python or plastic?
7:58 AM
I'm so sad
8:10 AM
I solved my problem, nvm
i need a bit of help,
i'm reading some image data that i need to convert to rgb values and draw to the screen, but i am confused about why i get this error:
`_tkinter.TclError: invalid color name "#4649464946"`
8:27 AM
Well, given only that piece of code, there really isn't much we can tell you that the error message didn't already tell you
Although, file[1:i+j] definitely can't be correct
seems to work fine,

Also, i have another script that takes a png file and converts it to the .pif format
let me send that
You do realize that you wrote file[1:i+j] three times, making your Red, Green and Blue values all identical?
how am i supposed to set the rgb values?
I have no idea because I don't know how PIF files are encoded, but I would guess r, g, b = file[(i*x+j)*3:(i*x+j)*3+3]
8:42 AM
its a file format i made, should've mentioned that first...
the rgb values are integers encoded as bytes and then written to the file
how does that differ from a bitmap file?
dunno, wanted to do it for fun
okie dokies... doesn't sound particularly like "fun" - but to each their own I guess :p
8:59 AM
@Aran-Fey This works, just had to change the order when i set the values :)
Also, is there any way to draw to the screen faster?
Yeah, do it all at once instead of pixel-by-pixel. Idunno any libraries that let you do that conveniently though
cant really do it all at once
unless i'm dumb
depends on your definition of "all at once"
In the same CPU cycle? No. In the same frame? Yes
9:15 AM
you might want to use numpy or array arrays for this.
how would that work?
@Aran-Fey doing it in one or two frames seems good enough for now...
9:31 AM
@Sect0r you would load the data part of the file into an array of machine integers.
machine integers?
the things you are currently doing via int.from_bytes(file[1:i+j],byteorder='big')
similar to struct, but for the entire file.
can't say exactly how it would look, since you haven't specified the format.
With values ranging from 0-255, file.read() essentially already does that anyway
9:50 AM
10:08 AM
is there any way to quickly change all variables from camelCase to snake_case?
I am ok if it involves having to install some specific IDE to do this
all = 50 + python scripts
I need help with my kivy python application is there anyone who can help??
Python is an awesome language indeed, I solved some problems way easier than in my other profession, c#
@JayGadhvi You need to describe your need to get help from here
Thank you @Alper for the response
i would like to know how can i add widgets realtime in my application using socket io
here is the link to the actual question
10:24 AM
Ah yes, the good ol' "I'm using these 4 technologies. Now please write my code for me" kind of question. No code, no information about what those 4 technologies are used for. Just 4 names and a vague description of the goal. And yet somehow it still gets an upvote :|
Actually, it is against the rules of the rooms that asking a fresh question in the rooms. Because you already asked it there.
I really have no idea what the problem there is. Do you know how to add widgets to a kivy gui? if no, go read a kivy tutorial. Do you know how to send messages via socketio? If no, go read a socketio tutorial. Then put the two together and you're done.
No @Aran-Fey sir im not asking to write code for me
i am complete newbie to all three technologies. and i aleardy have a working application
i just wanted to know if someone can help how can i integrate socket io with python so can add widgets dynamically in real time
and sir @Aran-Fey i did not ask this question for votes this is the first time i asked a question on stack
@JayGadhvi "I have a car, and it's running just fine. Now I want to add matter condensers and use the confubulator to ferkle the doings for extra speed. Can someone help me?" is not a simple question to answer, so most people will just think "no" and move on to something they stand a chance of helping with.
10:34 AM
i actually had no idead how to describe it in a shorter way @holdenweb sir
It isn't a matter of describing it briefly. It's a matter of describing it in such a way that people understand the help you need.
ok sir @holdenweb i try and make it more understandable. its the first time im asking something on stack
had no idea
@JayGadhvi before you edit, go ahead and read through: stackoverflow.com/help/how-to-ask
Following those tips will help you write a good question which will be more likely to attract good answers. Also, be sure to make your question as specific as possible---this will lead to more, and better answers. Try to figure out some parts of your question yourself, and only ask a question where you actually get stuck.
It's a common issue, don't worry. Perhaps take it step by step - show some kivy code and describe how adding a new checklist is supposed to work (nobody knows how many cheecklists you have or how they are organised). Then deal with the popping up bit later, for example.
@python_user most IDEs support such refactoring. I know pycharm does, but probably all the other ones too. Look for refactoring tooling.
Well, hold on. Generic camel to snake might be too much
I don't know. I misread your question in a haste and I thought you just wanted to change one specific name.
10:39 AM
sure. thank you @alkasm, @holdenweb, @AndrasDeak
But I wouldn't be surprised if there were dedicated tools for this job.
@JayGadhvi Your question is essentially like "I'm using an axe and a saw. How can I chop down a tree and cut it into pieces?". If you knew how to use an axe and a saw, you wouldn't have this problem. So go learn how to use them. What do you need other people's help for?
ok @Aran-Fey i've edited the question and added more details
And now how is socketio related to this? What kind of message do you intend to send via socketio? "Hey, please create a new checklist with the name X for the user Y"? Or "Hey, a new checklist was created, please reload all checklists from the database"? Or "Hey, I just created the new checklist with the ID X. Load it from the database and add it to the GUI please"? Or what?
And who is sending the message to who, anyway? Who are the two actors who are talking to each other via socketio?
11:00 AM
@Aran-Fey user makes the checklist which is being stored in the database. when user logs into the application he'll be able to see all the checklist he created before but when he creates a new one it should enlist below the existing list
So there's only 1 program involved in all of this? Then what's socketio for?
Who are you planning to talk to via socketio?
socketio is basically to make this transaction realtime
when user creates a checklist he has to logout and relogin to the application to see the changes or updated he made
Is this a web app?
no its a destop and mobile application
i choose kivy cause its cross-platform
Either way, I don't see what you need socketio for. If it's a web app, you send a HTTP request and then update the GUI with JS. If it's not a web app, you update your database and then the GUI. Again, you plan to send messages from where to where?
11:04 AM
@AndrasDeak I ended up going with this github.com/abarker/camel-snake-pep8, converted 2 files so far, the project I work with is not packaged well so it doesn't seem to recursively convert all files as the module claims
probably write some shell / python script to hack it
@Aran-Fey i read kivy documentation to see if i can update the GUI on an event
but did not find anything specific
Do you have a piece of code that adds a new checklist to the DB?
@python_user seems like you can just pass all python files as command line args
yes. i added it in to the question
Q: add item real time to the home screen using socket io

Jay GadhviI'm developing a checklist application in kivy python using dynamoDB for database storage. Whenever user adds a new checklist it should pop to the screen in real time. here is the code where i'm getting data from the dynamoDb and binding that data to widget and adding it to the screen class HomeS...

here its is
So why don't you make that piece of code update the GUI after it's done updating the DB?
11:09 AM
thats what i wanted to know if its possible using kivy
What? Why wouldn't it be possible?
cause i tried reading few articles
@AndrasDeak ohh, I notice it now from the docs, should be an easy job then, need to make sure "Warnings and theory" is something I dont have in this code base
@python_user all your work is in git, right?
@Aran-Fey and also the official documentation of kivy framework
11:11 AM
yeah, it is, also I am paranoid enough to have copied the entire git repo a folder just for this :D
I am on the process of tracing the entire code base, so I am just going to convert one by one as I walk my way, should be better that way
@JayGadhvi So... you know that you can write python code to create kivy widgets and add them to your GUI. I know you know this because you've already done it. And now you're telling me you unsure if it's possible? What? I don't get it.
@python_user OK
So instead of writing python code that updates the GUI, your plan was to write python code that uses socketio to talk to itself, and then when it receives a message from itself, then it updates the GUI? How did that happen?
no sir @Aran-Fey as i told you i did tried searching few articles if i can update my GUI when user is done creating the list but i couldn't find. thats the reason i was thinking to use socketio to make it real time
I really don't get it, but anyway... do you know how to solve the problem now?
For each checklist, you create a corresponding widget like this, right?
buttons = Button(text=Item['Listname'], size_hint=(1, 0.1), on_press=partial(self.gotoListScreen, Item['ListId'], Item['Listname'], Item['Description']))
So... just do that after you've added a new checklist to the DB
11:29 AM
Hey guys ^^ anybody experienced in using flask-praetorian?
1 hour later…
12:31 PM
Hello, how's everyone doing?
cbg, doing great
thats nice :-)
what are you up to?
not much, given that my country is in a lockdown. taking a walk is as exciting as it gets
which, now that the sun is coming out again, actually helps a lot with getting rid of my unwelcome recurring yearly guest; winter depression
are you guys still working from home?
i try to stay at home as much as possible
i occasionally go out to help mom or dad at work
12:44 PM
that is nice
other that that, i'm working on a thing right now
good luck with that
100% homeoffice since the ides of march last year
@Sect0r its a compression algorithm for an image format, if you could call it that. i'm currently trying to store the data into a bytes array so i can do stuff with it, but i dont know what it puts inside that array because if i try to print it my visual studio code crashes.
@Arne must be nice, my employer wants me working at premise march this year, so one month more
@Sect0r idk what any of this means, sorry but it looks cool
12:51 PM
Do you want to see the code for it?
I started 100% home working (again) a year ago September. Before that I did a couple of years working three days a week remotely. A short office-only consulting gig reminded me why I preferred home working. It is becoming more common.
May I know what method does the sort() function uses? Is it alphabetical or numerical? For example, addresses = ["220 Baker St", "1500 Pennsylvania Ave"] and when I sorted them, 220 Baker St comes before 1500 Pennsylvania Ave. How is that so? The example contains items that are not individually categorized as strings or numbers, it's mixed, hence my confusion.
No repro. Did you pass reverse=True or something?
Because you are sorting strings, and the order is "lexical": "DECB" is less than "DECC", but only just!
>>> sorted(["220 Baker St", "1500 Pennsylvania Ave"])
['1500 Pennsylvania Ave', '220 Baker St']
12:53 PM
^^ was going to follow up with that.
@Aran-Fey no, it's just plain sort(), like, addressed.sort()
@CoreVisional They're not mixed, they're strings. And strings are sorted lexicographically, i.e. by the value of their unicode code point
But of cours "220" is greater than "1500" because it begins with a higher character.
@CoreVisional Then either your inputs aren't strings, or your python installation is broken
...or the thing holding the strings isn't a list
An MCVE might be helpful, if you consistently get the unexpected result.
12:56 PM
So, the order of the sort() function is determined by the character's level, right
@python_user it is nice, I'm gonna miss it once it's over
@AndrasDeak Yes, that's what I'm gonna do now, no idea what's lexicographical ordering
yes. Compare ord("1") < ord("2")
@CoreVisional "lexicographical order"
@CoreVisional assuming strings
I see others have said as much, so: go read about lexicographical ordering?
Correct, but @Aran-Fey just pointed out that they sort as you expected. For strings Python compares characters one by one. If they aren't the same it proceeds to the next character, if they aren't then the smaller character denotes the smaller string. ("Smaller" meaning "having lower ordinal value").
1:00 PM
@holdenweb and this is all related to lexicographical ordering, right
Hello Everyone..!!!
that is lexicographical ordering
Yup. Python nowadays refuses mostly to sort mixed types. Apples and oranges, don't you know.
Hey How can I update the password of a user in mongo using python? I have the admin user name and password
@Nagendra_databee Not until 47 more hours pass, please read the room rules
1:11 PM
Hi all
@arielma you can edit/delete messages for 2 minutes in chat
I have the below assert in python:
assert scenario_result.get_details()["scenarioRun"]["result"]["outcome"] == "SUCCESS"
Is there a way to add another parameter to the left side? actually I want the assert to stay the same, just add more info (in my case it's the scenario["name"])
Are you saying you want to add more info to the error message?
That's the only place I can think of where you can add more info. If that's not what you meant, then I don't understand the question
I'll try explain. currently, this is what I get in JUNIT results in jenkins:
tests_project.run_test_CI.test_scenario_run[scenario0] (from pytest)
I need more info here like the scenario name
but how I add it to the assert without damage the functionality?
1:29 PM
If you want additional information in the AssertionError message, you can provide a string in the assert statement
>>> x = -23
>>> assert x > 0, f"expected positive number, got {x} instead"
Traceback (most recent call last):
AssertionError: expected positive number, got -23 instead
I'm talking in case assert is True
let's say in your example: if x = 0 , can I add more info?
besides the fact its true and the test passed
True assert statements don't produce any output at all unless your environment is doing something special
I'm not familiar with Jenkins or JUNIT but I'm guessing one of those controls the output you're seeing
The point of an assertion is normally to verify that program conditions are as expected in some fairly important way. Error messages indicate that some assumption you've made about the program state are false.
it's strange you can add only info in case of failure
assert scenario_result.get_details()["scenarioRun"]["result"]["outcome"] == "SUCCESS", "test " + scenario["name"] + " FAILED"
I wonder why I can't use also scenario["name"] in case of success
as I want in my case people to know which scenario passed, instead of getting: tests_project.run_test_CI.test_scenario_run[scenario0]
usually, the assumption with test suites is that if you didn't get an error message, the scenario passed
1:41 PM
I know that the unittest module has a verbose mode that prints the name of each test that passes, but it's easy to tell the tests apart there because they all have unique method names
It's weird that JUNIT doesn't print the method name
pytest -v will also name every test function as they pass/fail
Also, isn't Junit a test framework for Java code? I'm not sure how you're running it on Python
@arielma Can you clarify what information you want in case of success?
Usually, your unit-tests are well-defined so it is clear what happened if they pass.
Your output "tests_project.run_test_CI.test_scenario_run[scenario0]" suggests the test is parameterised. Are you looking for a speaking description instead of the technical "scenario0"?
Q: Function in pytest file works only with hard coded values

rel.foo.fightersI have the below test_dss.py file which is used for pytest: import dataikuapi import pytest def setup_list(): client = dataikuapi.DSSClient("{DSS_URL}", "{APY_KEY}") client._session.verify = False project = client.get_project("{DSS_PROJECT}") # Check that there is at least...

it's per the answer in this thread
2:10 PM
One way to construct the necessary parameterised tests would be to generate a list of (inputs, setup_list_result) pairs, then pass that to `pytest.mark.parametrize.
Another alternative would be to parametrize your fixtures, as described at docs.pytest.org/en/stable/fixture.html#parametrizing-fixtures
2:30 PM
it sound weird you can add all the info you want in case of failure, but nothing for success
stackoverflow.com/questions/65886249/… seems like an interesting question
The first comment answers it pretty conclusively IMO -- it's impossible if you're using only immutable values
OP needs functions
I was expecting some overriding custom class based solution
same here
The OP probably does not, though.
2:37 PM
yeah, I was just excited
I have a feeling that numbers are immutable for a good reason, and a custom MutableInt class would behave strangely in one scenario or another
The simplest implementation I can think of would work with OP's code as-is, but fail if he changes p += 1 to p = p + 1
If I was dying to have a mutable type that can hold number data, I would just use a list
... Not that using a list would completely solve OP's problem, now that I read it all the way through
Any ideas on how to solve this get overshadowed by a desire to scream DON'T DO THIS AT HOME, KIDDO!
Just use haskell
Nah just use sympy
Just fork CPython
2:45 PM
I think there's a jquery function that does that
3:02 PM
@holdenweb @MisterMiyagi @Kevin what about using record property? docs.pytest.org/en/stable/usage.html#record-property
Looks useful, go ahead and try it out
Always the best way to learn!
not sure I understand how to work with it
I can add it as another parameter in the funtion?
If you can't understand it, would it be a good idea to use it?
Depends on whether it's in production or not ;-)
3:16 PM
its not :)
2 hours later…
5:29 PM
Hey if anyone has experience with synology + python 3.8. And/or manually installing pip (which creates a problem with virtual environment creation as ensurepip isn't created by manually adding pip).
please look at
Q: Ensurepip module not existing, how to install manually?

paul23In the interest of not getting an XY problem: the goal is to create a virtual environment on synology dsm, so no apt-get, where pip is working. However this gives the following error: $ python3 -m venv new_venv Error: Command '['/volume1/docker/builder/new_venv/bin/python3', '-Im', 'ensurepip', '...

you should add a python tag to that question
python3.8 doesn't directly imply python? but added :)
It does, but nobody browses specifically python3.8 questions. 99.99% of SO users browse python questions
Not the prettiest solution, but can't you just download ensurepip.py from CPython's github repo and place it into your site-packages directory?
@Aran-Fey I'm really really reluctant to do that, especially since the python package is core of the synology dsm (OS). Don't wish to break some hidden tool from synology.
If you know it won't break stuff I'll add it: but then what happens if synology package manager once again updates python with a new install?
I don't see how that could break anything. The worst thing that I can think of is that a future version of python will include ensurepip, and your package manager will complain that it already exists
You don't even have to drop it in site-packages if you want; you can also place it wherever you want and modify your PYTHONPATH accordingly
5:40 PM
yes - that leads to this problem
After get-pip as I was explained earlier I indeed have pip
and you updated it?
but now python3 -m venv new_venv stop on "module ensurepip not found"
pip3 --version show pip 20.3.3 from /var/services/homes/PaulWeijtens/.local/lib/python3.8/site-packages/pip (python 3.8)
Wait what:
$ python3 -m pip --version
how did this happen
pip3 is a single executable/library sitting somewhere on your system. python3 -m pip is the one specific to the python version your are using.
5:48 PM
Yeah but check the location - they are the same XD
Anyways, error still exists
$ python3 -m venv new_venv
Error: Command '['/volume1/docker/builder/new_venv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
And checking for the module "ensurepip" (which it seems to try to find looking at the arguments:
$ python3 -m ensurepip --version
/usr/local/bin/python3: No module named ensurepip
Hm, you could try and copy ensurepip from a proper version of python3.
But really, why not install another python3 from source?
6:04 PM
Yeah I'm almost thinking about doing that - but then everything gets iffy with when what python version is being used
6:15 PM
Does it? The one used is the one on PATH unless specified otherwise (which since you're using venvs, the one you use to invoke venv will be simlinked in that venv so if it's activated it'll refer to the correct one each time)
I'm sorry I am not getting your, what you do mean with "does it"?
You said "everything gets iffy" and I meant "does it really get iffy?"---I just mean, it's not like it's non-deterministic. You type python and it uses the first one on PATH.
I mean it gets confusing with all the automation scripts and "updates": where some newer would use a custom python install and directly call those (can't add that custom python to the PATH variable lest I might break some custom synology program). While others use the system python version.
So any update to either the scripts or the python version has to take into account those things.
It's clear when you run the script manually: but not when things happen because automated systems, which might even run on elevated users (which hence have their own home directory etc).
all this just for pyYaml though XD
I don't really follow since I'm not privy to what automations you are talking about nor do I really understand what the problem is. If stuff works as is, then installing a new version of Python, as long as it's not first on PATH, should break nothing.
Yeah but then in the future I might update (my own) version to python 3.9. And also use those features in scripts.. However it might still break.
6:28 PM
What might break?
And then I discover later that this is due to it being implicitly ran through python3 .... and thus not use my own version of python.
who is implicitly running it that way?
Say the system as cronjob.
but you control what code gets ran and therefore which environment the code runs in
Sure, I can work around it: but that would mean I'd have to re-evaluate the whole system right now.
6:31 PM
For maximum non-breakedness, don't rely on the system to magically have what you need. What you need to run smoothly is to install the proper dependencies, which means your script installation process should do that (including the Python versions). Additionally, executing your automation should create an environment where the code can run without problems. Otherwise you're just crossing your fingers that things will always work.
Otherwise you'll always be at the whim of people executing things wrong, which you can't prevent. IMO this has nothing to do with Python. It would also be the same of say, dynamic libraries in a compiled program.
Well with that reasoning we shouldn't use shell executables either - but the world is full of those for automated tasks (and basically I was in the process of moving all shell tasks to python to improve readability).
I work on systems that are fully reproducible so....yeah, I agree, it is best not to assume specific versions of shell executables either. OTOH bash is pretty static comparatively to Python. But if you wanted to use some new feature on the newest version of bash that wasn't normally installed...you'd have the same problems. If you don't want to be holden to that, then don't use new Python features :P
7:25 PM
Is there any decent guidance on when package objects are getting too high up? For example, if I have a package called beatroute and the top-level __init__.py contained:
from beatroute.core.errors import (ProblemError,
To me, that's rather convenient because I don't expect any of those names to clash with something you'd want to define in the code using the package. But I do constantly see errors modules in the API of packages when it comes to imports
I've gone through PEP8 but I can't get a sense of "wait, you've gone too far in hoisting these objects up to the package level"
I personally like to have an errors submodule because I dislike ending all my errors with Error or Exception, and then it's not always obvious that a class is an exception. Or other times, some exceptions have very similar names to the exceptions of another module (or builtin exceptions). For example, instead of creating a TimeoutError I would just work with my_project.errors.Timeout instead
Ok, that's an interesting point that I'd not considered
Well, I suppose my 2nd point is irrelevant because you could just do my_project.TimeoutError, if there was any chance of getting my TimeoutError mixed up with another similar-sounding error
So I guess all I have for you is "I prefer errors.Timeout over TimeoutError"
I think that's still worthwhile feedback tbh because I'm looking at that __init__.py file now and thinking "I bet this is too cluttered/gonna shoot me in the foot with the API down the line"
1 hour later…
8:39 PM
Is there some trick to catenate python imports? In this example, both of them would go to `util`

import library.util as util
import another_library.util as util
What outcome do you expect/want?
Was hoping that functions from library and antother_library to be called from the same util namepsace
So presumably both are modules. You want to take the union of modules.
Without knowing if and how that's possible, that's a terrible idea normally. Namespaces are one honking great idea.
8:45 PM
Sometimes we must do what is necessary and not what we'd want :-)
Like when refactoring
Is there some really dirty trick where I can manually produce the union in a single python file?
Why is it always that you end up with these weird constraints? :P
@Mikhail now you're bringing "python file" into this...
Yeah! Its not fault -)
you could have a module that imports everything from both utils... probably something from stackoverflow.com/questions/12540290/…
I've been reading about IPC and im trying to pick the best way to send data like dict, list, set, etc between 2 applications. Currently im testing with multiprocessing.connection Listener/client but having to pick a port and then store that somewhere so the client knowns how to reach the server bugs me. I dont think I can send objects on a stream but I could change the way I handle the data. Any recommendations?
applications are on the same machine
9:08 PM
If you need to serialize the data then you could go with JSON, but set won't work out-of-the-box
@sidnical I've had good experiencing using ZeroC ICE
@roganjosh I would only need to serialize the data if I did pipes though, right?
@Mikhail I did see a mention of zeroC but it sounds similar to multiprocessing.connection. I'll read up on it.
I don't think I follow your question properly. They are decoupled applications, right?
Someone recommended using flask. Then i'd only have to send something to loopback/<aroute> but flask seems like alot for this.
@roganjosh if by decoupled you mean separate applications then yes.
Don't reinvent the wheel you're going to need most features in ICE
9:14 PM
Flask could be surprisingly light-weight for this, but it will be a mess if you have multiprocessing involved in the second app
In which case, I don't think Flask is a bad idea, but you'll need a queue
"need" --> "want", really
@roganjosh I didnt think about it getting stuff out of order. Noted.
@Mikhail i'll see what ICE has to offer. Thanks for the recommendation.
10:00 PM
@LutaayaHuzaifahIdris hello. Please don't ask for help here with fresh questions on the main site as per our rules.
10:20 PM
Thanks @AndrasDeak, maybe kindly give me access in that group
that room is our garbage bin. There's nothing to do there
