« first day (3939 days earlier)      last day (992 days later) » 

1:39 AM
Hello, tomorrow (in the morning) I will convert 3 QThreads, into 6 multiprocesses.
I don't know if it is a good idea but I will try. The three of six will return after execution and the other three may run under while True loop with time sleep where this is neccessary.
All six new multiproccesses will be under the same class, but I don't know if I can access the class variables in each process (multiproccess Queue)
I will do this because I want to prevent gui freezing (pyqt5)
If either this will work, I will rewrite the entire project in C++ or Java, but I work on it longer that 16 months :/
But there is a problem if pc has less than 8 cores right?
 
2:17 AM
@ChrisP what's your problem?write a post in stackoverflow
 
 
3 hours later…
5:33 AM
Hi Guys
Anyone up that can help me out real quick?
 
you can go ahead and ask your question as long as it is within the room rules, there are users here with various level of expertise who can help you
 
I am new to python and I am really stuck on this part. So I created an virtual environment, install all of the stuff in there
but when I try to run my code, it say ModuleNotFoundError
 
ok, have you activated the virtual environmnet?
 
yes
Like when i use import requests
I think it is looking for the data elsewhere
and not the virtual environment
 
so any library you installed is not showing up in the venv?
 
5:38 AM
so in the terminal, I did pip list
I see requests there
and import pandas does not work as well
 
You might want to verify that the expected python is being executed by running python -c 'import sys;print(sys.executable)'
and compare that output of pip list with python -m pip list
 
so in the command without virtual environment, i do not see requests or pandas
but that is to be expected right?
since i install it in the venv
 
it sounds like the issue is that the correct venv wasn't activated correctly
 
import sys does work
 
sys is a built-in
 
5:45 AM
so when I do import requests, i get something like Traceback (most recent call last) ~\AppData\Local\Temp/ipkernel_6672/2072270154.py
and it say ModuleNotFoundError
but that folder doesnt seem to be in my venv path
 
what ide are you using?
 
Visual Studio Code
I am using Jupyter too
been trying to fix this all day lol
 
do pip install requests
 
i even reset my computer
outside of virtual?
 
in ur terminal
if you in windows do that in cmd
in mac do in terminal
 
5:49 AM
yea i did that
cmd
 
and what does it say
 
it said requirement already satisfied:
 
and pip install pandas
 
same
 
now what does it say
when your run ur python file
 
5:53 AM
Same thing
I think it's looking for the module in a completely different folder
in a \AppData\Local\Temp/ipkernel_13012...
wait
so in Control Panel
where the Environment Variables
I see 2 variables where they might try to pull it.
the TEMP and TMP
nope still doesnt work
 
so in cmd when you do python --version what does it say
do
where python
 
6:09 AM
I have version 3.9.6
and for the where python, i see 3 location
one where i set up virtual envir, one in the python\python39\python.exe
and AppData\Local\Microsoft\WindowsApps\python.exe
the python39 is also from AppData\Local\Programs\Python...
the virtual environment path is \Documents\Python Project\Code\venv\Scripts\python.exe
 
Stupid solution: subprocess.run([sys.executable, '-m', 'pip', 'install', 'requests'])
 
is that for the terminal?
 
@Phiking You might want to take a look in this thread as it sounds like you are also trying to use the venv from within visual studio code.
 
6:31 AM
thank you so much
I think it is good now
I had to add in the file path for setting.json
 
 
2 hours later…
8:09 AM
@Aran-Fey To be even more pedantically specific, code in a class''s class scope is only executed once, at class definition time. This encompasses compilation of methods and binding of methods and class variables in the class namespace and finally when the class body finishes execution the class is created by calling its metaclass (often type) and binding the result to the class name in the containing namespace.
cbg
 
hello!
is it possible to know whether an AttributeError is being caused by a simple attribute or by a function call?
my goal is to handle both cases in __getattr__.
 
In principle, you can inspect the traceback to find out where/how the error was caused.
That's... not something I would actually recommend, though.
 
alright. thanks! :)
 
Can you clarify why you want to treat the two cases differently?
 
8:18 AM
just learned about getattr and was curious.
i tried
return (lambda:"A") if isinstance(attribute, type(lambda:None)) else "B"
but i guess attribute is an str...
 
Where did you get attribute from?
 
def __getattr__(self, attribute)
 
Hold on a moment. Take a look at the formatting guide and play around in the sandbox.
But yes, __getattr__ receives attribute as a str.
foo.bar is equivalent* to type(foo).__getattr__(foo, "bar")
 
thank you very much!
 
8:41 AM
hello hello
been a minute
 
hiii
 
8:58 AM
hey cs, how've you been!
 
9:52 AM
cbg
 
10:31 AM
cbg
lets put python at top of the rooms
 
10:50 AM
I concur to what Xavier says
 
And I hate noise for the sake of noise, so let's not
 
11:09 AM
Finally managed to draw out an expected solution time for my vehicle route optimiser (nobody wanted to bring up the SLAs). 25 seconds! All this time, I've been battling my own guessed SLA of 0.5 seconds. Months of pressure lifted, woo! Would have been nice if Sales would have raised this earlier...
 
You're not working for Valve, are you?
 
Nope :) At least now I can put off learning async properly for another day :)
 
Excellent! More time to learn typing! \o/
shows themselves out
 
*closes the door*
 
11:47 AM
hey folks I do math not programming so have a really basic question i need help with
I have two arrays, the first is just a bunch of random numbers, the second is some function of those random numbers.
Now I want to sort the second array into ascending order
but I want to first array to sort in the same way
so the random numbers stay associated ( via their index ) to the sorted array
 
do you need to have the function list / array separately?
if not you can directly sort the list using the key argument for the sorted function
 
@Monty See this question
 
@Aran-Fey thats exactly what I need :)
super
thanks
Hey @Aran-Fey can I ask a related thing
basically the reason I wanted to sort them like that is so when I plot them the plot that python draws doesnt go all over the place. Maybe there is a simpler way of telling python to plot so to avoid sorting the lists
 
I don't know anything about plotting, so I can't help there
 
Are you looking for a scatterplot perhaps?
 
12:04 PM
@Monty no
@Monty for numpy, use inds = x.argsort() and sort both x and y with that
e.g. ax.plot(x[inds], y[inds])
 
12:21 PM
@holdenweb No, but it sounds like a promising line of inquiry.
 
12:52 PM
Good afternoon
I'm not sure if it's ok to just drop in here and ask questions, I would ask on main but I don't understand enough of what I'm doing to put together a coherent question (yet)
 
Ask away
 
I'm fairly ok with creating simple python scripts, and i need to create something that connects to an odbc datasource for which I only have a 32 bit driver. Which I think means that I need 32 bit python with pyodbc
now on the server I can't pip install pyodbc because it has no internet
so I ran
> pip download pyodbc -d somefolder
transfered somefolder to the server and ran pip install pyodbc.versionwhatever.tar.gz
this results in an error that I need visual c tools
 
"Which I think means that I need 32 bit python with pyodbc" i dont know whether this is true or not. in genral, you really should use python x64
 
this post suggests getting a "wheel" file
 
Have you tested your hypothesis about needing 32 bit python?
 
12:57 PM
I could test it but pretty much every google result tells me I do
but let me finish first, and if that's my best option I don't mind trying
then here I find wheel files pypi.org/project/pyodbc/#files but only 64 bit for python 3.9
 
Perhaps lfd.uci.edu/~gohlke/pythonlibs/#pyodbc has one that suits your needs
gohlke is the first place I look when pypi doesn't have the wheel I need
 
I'm somewhat confused by the 32 bit driver topic – as far as I understand it, pyodbc already ships with everything it needs.
 
oh looks like it does
brb testing
@MisterMiyagi it's a propietary database
@Kevin at least it installed succesfuly
 
Progress!
 
But ODBC is not proprietary, it's a communication standard. So you should be able to point pyodbc at the specific driver that handles the communication with your actual DB
 
1:04 PM
@roganjosh yep and that driver is a 32 bit dll
 
I suspect a 64 bit python with a 64 bit pyodbc would still be able to talk to a 32 bit driver. But I won't tell you to give up on the 32 bit Python approach. If it works, it works.
 
"python has stopped working" when iterating over the cursor
but at least I'm a step closer, I can search for myself a bit from here
thanks already
and many others seem to suggest it's futile to try
 
Hmm. I believe it. I'm all too familiar with dll-related compatibility problems.
My practical advice summing up to, try cursing and restarting Visual Studio. That works about 75% of the time
 
1:53 PM
@TomV please refrain from posting expletives, and oneboxed animgifs are usually also frowned upon.
 
Hi developers, I'm a newbie here, looking for a solution that has been giving me sleepless nights
 
@Oreximena hello. Please read our rules before asking.
and welcome
 
Thank you Andras, I don't seem to have violated anything, so am I good to go?
 
@Oreximena of course not, you barely said anything yet :D But you might plan to ask about a new question on the main site.
 
Just in case u guys missed me I'm back :)
and I need your help
 
2:02 PM
Welcome back
 
your 8 ball :)
still didn't figured out that numpy nonzero
 
if you have an MCVE we can help
 
yup, I do
from the answer I got on my question
 
should i paste it here
or
the problem is...still those extra small pixels that are outside the contours
you guys suggested here
that numpy nonzero could help me
this is my question
 
2:11 PM
I wasn't involved in that, so you'll have to explain the problem as well. Part of an MCVE is a clear problem statement with a self-contained premise
You have some data, use dummy example data. You want to do something or want to end up with something. Explain it, in clear and concise terms.
and I don't want to see screenshots of a person this time, because that would sound irrelevant to your question
 
ok...no screenshots...
 
You have an array of an image, and you want to do things with it. A runnable MCVE should be something like four lines, complete with imports.
Alternatively you can just explain what you're trying to do, but from experience that won't work so well.
 
the canny edge detector detects points pixels that are not part of that countour...so the cropping part doesn't work as it needs to...
 
Getting closer. What canny edge detector?
 
this one in particular
canny_output = cv2.Canny(im, 120, 240)
at least they are displayed at this point....
but than I have this part
# Find external contours
cnt, hierarchy = cv2.findContours(canny_output, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
 
2:19 PM
if the noisy pixels are more like salt-and-pepper noise, binary erosion can probably help remove them
that's all I can say without an MCVE
 
yes, they are like salt-and-peper
is there a difference between binary erosion and thos numpy nonzero thing you guys suggested ?
 
I don't know what numpy nonzero thing we suggested. Asking about a vague potential solution without explaining the actual problem is the epitome of an XY problem.
 
arrrrrrrr :) ok i'll look into binary erosion
 
@Andie31 The thing is, I'm one of the not so many people here who could actually help you, but I've already spent half my available mental bandwidth on trying to coerce a clear problem statement out of you.
 
thank you again !
and I appreciate your help !
 
2:24 PM
good luck
 
and i'm sorry...but again...I'm just a photographer who tries to speed up his proccess of cropping images...because photoshop is not as clever unfortunately yet as python is !
 
And that's an admirable goal. Any task that can be automated, should be. But we're fairly low on psychic juice these days :P
this is all about making you ask a question that can be answered by other people who don't see into your head and into your computer
To turn it around: I could ask you why my photos are blurry, and you'd try to ask me about the circumstances.
(the end result would be a combination of factors: cheap camera, cheap lens, low light, clumsy photographer :P)
at least I have a decent flash now
 
very good example ! as usual ! sorry again :) now i feel you :)
thanks again
 
No worries. If you think you can put together something more specific, you're always welcome to come back and ask.
 
yup !
 
2:29 PM
And of course you're welcome anyway to stick around and chat, needless to say
 
ciao
 
bye
 
@AndrasDeak Please tell that to the sysadmins at my company.
 
@AlexandreMarcq well, there's also the consideration of job security :P
 
"Automation is a waste of time." - the guy that told us to setup ~75 computers manually
 
2:33 PM
Did you also work for the sysadmins?
I thought it would be their task to set up the 75 computers (in whatever they way like)
 
Setting up 1000 computers is a press of a button here. :/
Alright, I'm exaggerating. Five button presses and some typing.
 
Back in my high school the default boot option on the computer lab PCs was a windows reinstall. They'd just turn them on and they'd take care of themselves. Arguably setup at a company is more complex than just installing whatever base windows was around at the time, but still.
 
I used to be one of them, until my school realized that the missions were not interesting enough.
 
Out of curiosity, do other people also get notifications on Stack Overflow with a significant delay today?
 
@MisterMiyagi I heard complaints of that, probably related to maintenance earlier today
 
2:36 PM
@MisterMiyagi I was thinking about that the second before I saw your message.
 
claimed to be fixed an hour ago meta.stackexchange.com/a/367989/313143, so either it wasn't, or this is something different, or caching
 
@MisterMiyagi The worst part is that every setup was the same, but no automating it was wasting time and energy.
 
@AlexandreMarcq You have my sympathy.
 
"If you automate this I'll lose my job" is a valid premise
 
It's also a less-than-optimal work environment.
 
2:41 PM
Well, yeah, it harms everyone else. But it's understandable.
 
So far we've had good success with just inventing new things that need automating after being done with the old stuff. :P
 
I could understand this argument if they weren't already drowning in various others tasks. It could have avoided a month of work.
 
@AlexandreMarcq hmm, yeah. Then perhaps it's just some luddite thing.
 
Sorry I'll stop here, this room is about Python not venting about weird decisions.
 
2:59 PM
I think this is the first time I've seen Rust being called in python in the wild. It's seemingly more straightforward than I was imagining; we seem to be getting pretty good at blending different languages these days
 
We get pretty good at blending awesome languages these days!
 
3:11 PM
Is the ease of integration related to the compiler I wonder? For example, if LLVM-compiled languages lend themselves to integration much better
 
@AndrasDeak sorry, it isn't in the heap where I am regularly, didn't think much of it
 
@roganjosh In this case I think Macros are the magic sauce. Makes it much easier to generate the boilerplate automatically.
 
Ah, that makes a lot of sense
 
Had a pleasant surprise when writing some bit parsing in Rust. Macros felt basically like classdecorators, similar to how dataclass generates a class from just some hints.
 
3:37 PM
@AndrasDeak Thanks
 
@TomV no worries
 
3:57 PM
@Shayan you're welcome?
 
I, too, am thankful for Andras
7
 
4:12 PM
@Kwsswart I came across these benchmarks which might be of interest to you re: FastAPI
 
4:59 PM
:')
 
 
3 hours later…
7:34 PM
Folks, what library can you recommend for SVG ?
 
My brother recently did some work with SVGs and his answer would be "none, use imagemagick"
 
7:49 PM
Their docs look like they're from around the Millennium. I might give that a go, though, because I've struggled in the past with getting SVG to work properly in responsive pages
 
8:05 PM
You mean imagemagick? To be clear they only do raster graphics, but very well.
but they are really fundamental in that domain
see the alt text :P
 
8:26 PM
Very true :/
 
 
3 hours later…
11:20 PM
@Kevin Any joy?
 

« first day (3939 days earlier)      last day (992 days later) »