« first day (3602 days earlier)      last day (1345 days later) » 

12:56 AM
@toonarmycaptain the latter
Hey folks: Like we discussed before, please mark all possible dates/times that you are able to meet for a virtual hangout here: whenisgood.net/xyityin. Here's an agenda doc for talking points that you'd like to possibly discuss (we'll read from these if the room gets quiet): docs.google.com/document/d/…
 
 
5 hours later…
5:51 AM
@Raghav : Don't convert the input to an int. That will solve it for you.
 
 
1 hour later…
6:57 AM
looking for something similar to os.path.dirname(__file__) for pathlib
 
7:51 AM
@Raghav please stop reasking this question, you already got help
@Raghav You have to read a good tutorial and practice with simple problems to understand why you can't call list on an int
 
8:34 AM
cbg, all
Potato
 
8:55 AM
Ahh, nothing like a few revenge downvotes to wake you up in the morning. cbg
 
Ah joy, the backlog refinement meeting. [immerses in technical debt].
 
You can consolidate all that debt into one simple monthly SCRUM meeting, I bet. At least, I keep hearing about this consolidation thingy on TV. The APR is 1600% but take the quick win
 
9:22 AM
Technological usury? You mean Microsoft?
 
Lol. They should at least ship with a fact sheet to bite back at those kind of comments but alas, I have no comeback
 
9:42 AM
@roganjosh heh - yeah I have. That's bitten me in the past
 
I remember that from our last discussion about alembic :) I did some digging yesterday for the rebase that I thought existed, but it doesn't look like there is a method to consolidate the migrations in the way you're looking for
I mean, there is a method and that's just to delete the migrations and start again. But this time I'm more cognizant that you work with other people and I don't :P
 
I've never done that
>.>
<.<
 
I'm surprised that the migrations really take an inordinate amount of time. One option may be to have migrations for each major release if that's the case. Sorry I couldn't find the neater option I thought existed
 
Well, it's more that the migrations have to run on small embedded devices
So something that your regular PC can beast through, the embedded devices can struggle with
I wonder if there's some way to force alembic to accept that it's at state X
Because when I generate those databases, I would actually run the migrations on something that can handle the grunt
 
There is a way to do that, 1 min
I think it's along the lines of command.stamp(alembic_cfg, 'head') but I'll need to check back in the documentation, where alembic_cfg is from alembic.config import Config as AlembicConfig
 
9:53 AM
That's something I can go on mate, thanks. I'll get back to documentation diving again
 
Yeah, it's from here
 
Ah, you absolute dancer
Thank you
 
10:21 AM
@AndrasDeak Are you talking about the customers or the staff?
 
I was close to doing a pirouette of welcomeness but I really shouldn't have gone grave-robbing from that project where I used it; now guilt has added it back to my backlog of things I really should be developing when I'm bored :P
 
@roganjosh If there's no need to keep the schema history there's (surely?) nothing wrong with simply rebasing the schema migrations by dumping the existing schema and using that as a single migration? There's no need I can think of to go through each individual schema modification serially if you are only interested in the end-product.
 
For me, no, I'd just ditch it and do a pseudo-rebase by starting over. But I get the impression that it's important to tie the migrations to git merges and the like. I can't really comment on that, though, because pretty much every commit I make goes live and I don't envision rolling back
 
10:40 AM
@holdenweb the more I think about it, the more it seems like the migration history is just bookkeeping so once everything is merged, and particularly in the case where this is a bottleneck, maybe they would be better just bumping up the schema once everything is merged
 
Yeah, conceptually I've always seen schema migrations as being "this server's history" rather than a global history
 
I'm curious what your team has to say about that? Have you preserved the migrations from day 1?
 
@roganjosh I'll probably have to fight that battle at some stage. For now I'm quite happy with the win of reducing a 600m row table to 50m rows. Part of our data model was quite taken by surprise by recent volume increases.
@roganjosh That was pretty much my point: you only need the history if you want to be able to stop at a specific version.
 
@roganjosh Not from day 1, there's compliance issues with not being able to rollback
 
@OldTinfoil ah, ok. This seems like a decent driver
@holdenweb This is a big factor in my looking to give up the freelance side of things for a while. I get too unsure about my own ideas on best practice. I'll sacrifice taking on Scrum for a bit to get myself a better footing in general
 
10:58 AM
I read you - when I was freelancing more, it was difficult to actually get to grips with what best practises can be these days
 
May I ask what embedded devices you are working with?
 
There's quite a variety of them, but for personal projects and prototyping it's solely raspberry pis
 
I'm well-acquainted with the good ol' Pi :)
 
I'm worried I will have more Pis than bricks in my flat
 
11:26 AM
hey guys! I have come across a question in the insertion sort algorithm.
when we are putting the next element to the sorted subarray A[1..j-1], can we run a binary search to find its place????
making it to run in O(n(logn))??
 
11:41 AM
@roganjosh Please CV that SQLA UUID question as a typo.
It's the classic "calling the function instead of passing it as the default".
 
@IljaEverilä done
 
@OldTinfoil I have a nephew who's just starting to Python on a RasPi. I pinged him to ask where he had started, and he told me Django. I advised him to keep it very simple to start with. I think I've got about 8 Pis, but no 4s yet (though I did buy a 4 for my grandson ).
 
11:57 AM
Nice! I like Django as a starting point for people learning MVC methodology - even if you end up replacing all aspects of Django by the end of it
 
@IljaEverilä I was hoping to find a canonical for this issue but the search isn't going very well
 
12:13 PM
@PaulMcG Just so I am getting this right: You are looking for syntax/implementation to insert an infix operator with given precedence into an existing infix grammar?
 
Hello, I'm currently writing docStrings for my project. I'm wondering how I should deal with methods that call other methods that can raise custom Exceptions, but are not meant to deal with them. Catching that Exception happens in methods that call said method. Should I include the possible Exceptions in the docString?
 
method (deals with exceptions) --> method (writing docString) --> method (raises Exception)
 
@YPOC If the exception is part of the expected behaviour of the method, it should be documented.
If it is due to a bug, misuse, or very obscure corner case (e.g. MemoryError), omit it.
It doesn't matter whether the raise is actually part of the method itself or some nested call.
 
@MisterMiyagi So you think I should just include it in the raises-part anyhow?
 
12:20 PM
Yeah.
 
Ok thank you :)
 
@roganjosh It's not easy to search for, due to the end results being wildly different :P ("Why are all my dates a week old???")
Or "All my inserts fail due to integrity errors, why?"
 
In which case:
 
@holdenweb I've never thought much of frameworks as a starting point to learn a language... however, I generally fail at coming up with things in pure Python that would actually feel rewarding... at least with things like django/flask/pygame/etc... you get the impression you're actually able to "do something"
 
12:41 PM
@AndrasDeak I never pasted the whole code, that was the only time i pasted the full code asking for help
 
@JonClements Right. In his case he chose building a simple web site. I felt it was important for him to have the motivation of an objective, and since he's pretty much new to programming it will give him some immediate control and feedback.
 
Yeah... that's what I mean by having something to aim for and a sense of achieving something which you don't get by learning sequence, selection and iteration by itself :p
good ol' Michael Jackson :p
 
Well, the journey doesn't have to end up at the planned destination, but if you didn't have an objective and a plan you'd never leave your doorstep.
 
1:00 PM
ho
hi
 
rbrb, all. Cya later
 
bye
 
@JonClements Some simple terminal-only games like Snake or Battleship are pretty easy to do with just the standard library.
 
1:17 PM
@MisterMiyagi i cant able to drag and drop objects in pygame can you take a lock at the code?
 
@MisterMiyagi ahh... snakes... probably one of the first things I wrote in basic :p
 
@shyckh I'm struggling to find where MisterMiyagi, specifically, was helping you. If you're continuing a discussion, please make a directed reply to the message. If not; please don't ping people out of the blue
 
ok
 
1:32 PM
@shyckh Sorry, last time I looked we were talking about numbering fields. Have you fixed that? Is this a related problem?
@JonClements those were the times, eh?
 
Those were the days, my friend
We thought they'd never end
We'd sing and dance forever and a day
We'd live the life we choose
We'd fight and never lose
For we were young and sure to have our way
https://lyricstranslate.com
haven't listened to that in ages... think I might have to later now :)
 
Your earlier comment has got me on a Michael Jackson loop :)
 
@JonClements You just had me take a nostalgic trip through the curses documentation in "Python in a Nutshell". A great little library!
 
who needs GUIs, right? :p
 
1:53 PM
They have their place, but not really in the beginner's lexicon - though PyGame Zero makes an honourable attempt at making it easy.
 
wow... libraries are now going for names like the film industry and prequels?
 
Not quite. I suspect the name seemed suitably cute around the time the RasPi Zero was announced ...
 
i need a lil bit help if some one can help me out with pygame
 
Bit it's quite a good simplifying layer over PyGame. github.com/lordmauve/pgzero/tree/master/examples/memory was my contribution - I only know PG0!
 
stackoverflow.com/q/63595780/4799172 cannot repro; needs debugging details
 
2:03 PM
I wrote that at a London Python Dojo session, back in the days when people used to meet.
 
@holdenweb interesting game i will take a look on that when i finished working and learning pygame3
 
It's not exactly groundbreaking, but the PGZero author was looking for example code so about four of us came up with that. It looks like the repo still gets some love.
 
@MisterMiyagi i found out that people already made that game. they used blit and hard core coding like actually entering screen cords in dict
 
@Raghav I remembered your val = int(input(...)); list(val) lines; that's all there is to know about your full code
@holdenweb the company
 
I have multiple files to download from a hosted place, the url being hence common only the file name changes, how can I download all the files iteratively, I have created a dictionary of all file names, but then i will need to pass the key to get the value which looks like unnecessary step. What can be the alternatives for this? Lists?
 
2:11 PM
@AndrasDeak are the usurers?
 
@AndrasDeak i bump into another problem last day you hinted about indentation i solved that can you help me ?
 
I mean usury is a binary thing, you know. There are the usurers and the usured.
 
For the sake of the throwaway joke? Sure. I don't know much about MS and they could have turned their business model upside down, but whenever I read about them it's yet another way they are selling vendor lock-in.
 
@AshwinPhadke Try using a list instead of a dict.
 
@shyckh I don't think I did
 
2:14 PM
54 mins ago, by roganjosh
@shyckh I'm struggling to find where MisterMiyagi, specifically, was helping you. If you're continuing a discussion, please make a directed reply to the message. If not; please don't ping people out of the blue
 
@Kevin Yup thanks.
 
@AndrasDeak I would not try to defend their often-predatory business practices, but I do find it amusing that they have been forced to engage with what Ballmer scathingly described as "snake oil."
 
Is this becoming a pattern, @shyckh?
 
Uh oh ...
[sniffs]
 
no its about drag and drop
while i run my prog using a single image it works
 
2:16 PM
@Kevin to iterate over each file name in the list I can do something like for file_name in download_list is that correct?
 
Yeah
 
but with two or more images it does nothing
 
@shyckh is this again you trying to work based on that blog post that shows drag-and-drop pawns on a chessboard, without you understanding what the code does?
Aug 23 at 10:31, by Andras Deak
If you change random things in code you don't understand you are cargo culting which is also not a sustainable model of software design. You will forever be tied to other people helping you out. You have to learn (again?) how to read and write code before doing such things.
@shyckh have you read a good python tutorial these days?
 
@AndrasDeak its different for that i found another way
 
@MisterMiyagi Well it could be an existing one, or I could have a way to build new based on existing. Or since this is a wrapper around a pyparsing grammar, the wrapper could track what operators have been defined and at what level, and then build a fresh infix parser once all the operators have been added.
 
2:18 PM
Drag and drop is a pain in the butt to implement. Too much state to keep track of.
 
I'm just making sure that if we let you continue asking your question we're not wasting our time
 
so far i read 2 books on python
 
Back a few years ago, or recently? You said you've forgotten how to code.
 
yes
 
I can't help but lol here. Time for a break :P
 
2:20 PM
same
 
On the Zoom topics doc, I just added another discussion topic, about William McGugan's rich module (mix of tabulate, colorizing, and pprint). Now that I look at it, it would be good to probably work up a couple of examples for screen sharing.
(Didn't mean to ping inspectorG4dget, just wanted to reference your doc post.)
 
I think the better judgement of regulars is probably fine :)
 
I prefer bitter judgement
 
@MisterMiyagi And not really an implementation - I'd like to start with coming up with a nice API. Say I have defined a grammar for 5-function arithmetic in conventional PEMDAS precedence, how could someone who wants to customize the parser specify adding '%' for modulus operation at the same level as '*' and '/'? Or replace '**' with '^'? Or add '!' between mult/div and exponentiation? Or maybe drop exponentiation as not being relevant to their domain?
 
3:02 PM
Does somebody know a way to get a sim card with a public ipv6 address? I'm losing my hair over this. Like it can't be so hard and ipv6 addresses must be dirt cheap, why doesn't anybody want to sell me one?
 
@Hakaishin still not python, and unlikely for us to be able to help
Not sure about SE in general... reddit perhaps?
 
@AndrasDeak sorry, was more of a vent, then a real question.
 
got it
 
Is this the correct way to save downloaded file in the current directory ? os.path.join(os.getcwd() + model_name) where model_name is file name
 
@Hakaishin And you really need to read up on how SIM cards actually work behind the scenes
 
3:13 PM
It will create the directory with the file name I guess or do I have to do that if dir exists stuff?
 
@OldTinfoil any good starter link?
 
Not offhand no.
 
@AshwinPhadke what do you think os.path.join does when you pass it a single argument?
 
@AndrasDeak gives you the path in full?
 
wouldn't you want to pass the two arguments separately to be joined rather than using + in between them?
 
3:25 PM
@Hakaishin I think MM told you that it wasn't all fun and games :) It's an option on my own server but I think I'll hold off
 
who's MM?
 
MisterMiyagi Sensei
Aug 12 at 9:57, by MisterMiyagi
No, not at all. Using IPv6 is a lot more complicated than handling colons instead of dots.
 
FWIW, I'm having the reverse problem ATM. My ISP is doing everything IPv6 and has fake-IPv4 on top (is that still called NAT?). Totally wrecks the software of my cloudified speakers, because they only do IPv4 and can't deal with the fake-IPv4.
 
@roganjosh well it can't be more complicated than nats and all the various coping mechanicsms for dealing with ip4 shortages
I just want a simple vpn to a device. But without a public ip this doesn't work. Anyways enough distraction for the channel before Andras gets grumpy. Also it's time to go home and not think about this anymore. I think tomorrow I'm gonna try hand this project of to a colleague :P
 
@Hakaishin The usual solution to such problems is dynamic DNS, where you can ping a server to update your IP.
 
3:32 PM
@PaulMcG I'd probably shoot for a straightforward implementation of the behaviour you want, using the operator symbol as a key. E.g. operators.add(Unary('!', some_impl), after='*', before='**'). Though it may be worth to ponder separating the operator ordering from the operator mapping.
 
Hmmm, I like the idea of separating the ordering from the mapping.
 
@Hakaishin I'll drag you into a side-chat
 
after and before args feel code-smelly. Maybe simpler to just give the dev a view into the existing order, and then they use list insert/del semantics. Probably need an Operator class that they use to do the mapping, and then insert the mapped operator into the current list - or add to an existing level as in the case of adding mod at the same level as *.
 
3:48 PM
I've used before/after with topological sorting for plugins with dynamic dependencies. That worked reasonably well.
Though you probably do not want to deal with cases when an operator could be in a range of positions instead of a fixed one, that is true.
 
@holdenweb That implies to have a public ip in the first place. We have dynamic dns for our non fixed public ips. I dont need a fixed public ip. We can handle rotations as you said, but I need a public one nonetheless
 
@AndrasDeak ah that's why the current directorys name is getting appended at the beginning of the saved file it seems
 
cbg, yall
 
4:17 PM
asking for code (which I shamelessly provided): stackoverflow.com/q/63601473/198633.
 
Closed
But you answered it?
 
yeah... I was bored
 
:(
 
closing and answering is generally considered bad form
unless the answer is so hilariously complicated that any teacher would realise the cheating
 
honest question for the seniors (like you, Josh):
we at SO clearly don't like no-attempt questions, and close them. Does answering such questions (and voting to close) just perpetuate this unwanted behavior?

(since you mentioned bad form): why is it bad form?
 
4:20 PM
@inspectorG4dget yes, closing means "this should not be answered"
 
I've actually done the overcomplicated answers before. I should get back to that form of trolling, lol! That was quite fun
 
if it's a dupe, it additionally means "... because it's already answered <here>"
but also yes on the perpetuate thing
 
@AndrasDeak really? I thought it meant "this should not have been asked this way"
 
That's the usual reason for why it shouldn't be answered. Sometimes the question is inherently unanswerable.
 
Yes. I think that posting an answer does do that. And closing after an answer raises suspicions in my mind that someone just wants rep and is closing the door behind them. It's only because I know you that I think differently
 
4:21 PM
yes on the perpetuate <- that's news to me #til. I'll throttle my trigger impulse better, then
 
Another reason: upvoted/accepted answers hinder roomba
 
whoa! I'd never actually considered the rep-gate. Thanks for clarifying
 
@inspectorG4dget extra sleazy version of that: hammering as a dupe after you answered (there are a few edge cases where this can be merited, but those are rare)
 
ok I'm guilty of these behaviors (if you look at my past activity). To be clear, I always thought of it more like "here's the answer you wanted, but also <dup hammer> for additional reading and signboarding for future googlers" (and honestly not for rep-farming), but I'll stick to just dup-hammering, going forward
 
The "because I know you" is important :)
 
4:26 PM
there's also a great war going on between content curators and helpgivers, so there's always plenty of people who agree with your approach for what it's worth
 
I took a lot of flak about answering in comments but I still maintain that, if I can answer fully in a comment, I probably should close. If I can't find a dupe, I'll do just that
 
Thanks for understanding :)
 
^^ That opinion isn't shared
 
I've answered in comments before, when I haven't had time to write up a proper answer. Basically, "here's the answer. Someone can gain it for rep. I just care that you have the answer. kthxbye"
 
I'll rather answer in comments after switft closure than have someone post a trivial answer. And with dupes comments can be extra helpful.
 
4:30 PM
that's brilliant! I think I'll adopt that
 
4:48 PM
How can this line os.path.join(os.path.dirname(path) , 'detect_models/' , model_name + '.tar.gz' give two different values?
for the first time it gives the correct value and for the second time it shows the path to home directory
 
What are the two different values?
 
first value is home/username/dir1/dir2/dir3/file.tar.gz and second value is /home/username/dir1/file.tar.gz
 
I'm guessing that when you compute the second value, path has changed to include your home dir
 
@inspectorG4dget that would happen only if I am using the earlier variable that line of code was assigned right? But I declare another variable for the same line to avoid issues and use it the second time.
 
or the code is in a loop... Basically, we can't debug this without seeing /all/ of your code that's relevant to this bug
 
4:56 PM
I just debugged the code and it seems that the first value is also equal to the second value but the file is stored in the correct location nonetheless, how is that possible?
@inspectorG4dget I'll put up a example
 
symlinks?
 
@inspectorG4dget idk what that is.
here;s the code : pastebin.com/5buKpB6b
detect_models is abc_dir in the third use forgot to change
 
there's no way that's legal python code in your pastebin
 
It's a fun mix of comments and code
 
it is.
ah oh that way, I forgot to put the # too
 
5:07 PM
please post code that I can copy/paste/run to reproduce the behavior you see
 
@AshwinPhadke I'm not a linux guy but I struggle to get to the bottom of the supposed issue
 
@roganjosh heheh how can one not be a linux person, i'l put up a corect pastebin
 
As soon as someone turns Windows into a chant, you'll find me in that crowd
 
@roganjosh I am seeing that for the first time
 
5:11 PM
Upadated code snippet : pastebin.com/TsWgmVSg
 
It's well-known that I'm always on Windows
 
@roganjosh I thought many developers are linuxy , good to see a windows guy too
 
I may have to move to a Mac. I'm struggling to envisage how bad that's going to be. I'm slightly grumpy about that
For sure I'll just be floundering about at first
 
@roganjosh Don't wait too long, I'm already considering the opposite if things keep going the same direction...
 
5:19 PM
@roganjosh ping me when that happens. I've been on OSX for a while now (at least for work). Happy to point you to must-have software, etc
 
@AshwinPhadke Read the man page for wget: wget.download takes a URL (or, apparently, a local filename) and stores it under the same name in the current working directory, I believe. I can't confirm that from the source because the repo was a Bitbucket mercurial repoand Bitbucket no longer support mercurial ...
 
I just found out that the second operation performed correctly but in a completely different directory, just how?
 
@inspectorG4dget that might actually be really useful, if I can get to grips with the menus and stuff. I've only tried using a macbook once and I was like a toddler on it :P
 
@holdenweb but then how is it downloading the file in two directories at the same time then
 
@MisterMiyagi ... forebodingness (I just made a word) is not good if it's coming from you :/ Are things about to get really bad?
 
5:23 PM
@roganjosh Nah, just a slow and steady decline of quality, drifting from power users to hipsters. pulls up turtleneck
 
Beats me. wget.download is supposed to return its filename, but you're throwing that away. Lkike I say, wothout code and for such a poorly-documented, you might be better off explaining the real problem (which I presume is "I want to download ... from the Internet") and discussing possible mechanisms.
 
It's still the best of the worst, but if Windows catches up on that UNIX kernel...
 
@MisterMiyagi Oh, that's fine. I already planned some shopping time if I'm gonna move jobs
 
@holdenweb it seems odd to me too, I just checked it yet again, wget is downloading file in one directory and extracting it in other while the value to the path is still the same.
Let me explain
 
wget downloads the file to the current directory? (second time)
 
5:27 PM
I have a project directory that has project files and folders, out of which one folder is where I want to save a downloaded file, now the code to do that is in another folder of the same project directory lets call it code, so I execute that python from code and expect it to save and extract the file in another folder which is in the main project directory let's call it download, but in this case the file is getting downloaded in download but extracted in code, how is that possible?
@holdenweb please read above
 
@AshwinPhadke Not the cause of your problem, but there really is no point to prepend/join the CWD to a path. Either the path is relative, in which case it is relative to the CWD anyway. Or the path is absolute, in which case at best a prefix is discarded (Win), at worst bogus (UNIX).
 
@MisterMiyagi how would I go to the upper level directory and then go into the folder and save there then?
 
@roganjosh happy to help. Please feel free to shoot me an email when the time comes, if I happen to not be around here
 
proj dir -> code(where that code is), I want to save the file in proj_dir - > download, how do I give the path to download flder?
 
@AshwinPhadke I'm afraid it would take a long time to unpick that description. But it does sound like you believe that the directory where a piece of code lives might affect where it stores files, which isn't true. Perhaps if you refactored the code to use names like from_path and to_path it might be a little easier to tell what you're trying to do. I don't even really know what's wring yet except something isn't landing where you think it should.
 
5:32 PM
@holdenweb check the message above just your message i have out it simply
 
@AshwinPhadke You may believe you have put it simply, but my continued failure to understand what you want to know suggests otherwise, since I'm moderately experienced at Python.
 
@AshwinPhadke The parent directory is .., and a file in the parent directory is ../some_file.
You might also want to consider pathlib instead of os.path, since it has a more modern, intuitive interface.
 
Here's a suggestion: check the value that your call to wget.download returns.
 
@MisterMiyagi Ill check.
@holdenweb ok
 
But after that, if you are still struggling I'd expect you to go back and ask yourself what problem you are really trying to solve. Is there a reason you are using wget?
It sounds like there should be quite a simple solution.
 
5:43 PM
there is a simple solution, it;s taking time for me lol, also urllib was not working for me hence switched to wget
 
Yes, but you still aren't stating the problem: the actual end you want to achieve!
 
oh python's wget is poorly documented. I remember having to read sourcecode to figure out what was going on. To be fair, that was 2 years ago
 
@holdenweb i want to go up 1 step in a directory using any library possible
 
In order to ...
 
go to a different directory that is there
 
5:47 PM
hi guys
 
And when you "get to" that different directory, what do you want to do then?
 
@holdenweb save the file there
 
@AshwinPhadke are you looking for pathlib. The best library to move between directories and access data and files
 
@HamzaZubair i will check that os.path looks completely complex for simple tasks
 
from pathlib import Path
parent_dir = Path(__file__).parent
 
5:51 PM
OK. There are two sorts of paths (I'm ignoring all the stupid Windows drive letter nonsense): absolute paths begin with a slash, and file location is determined starting at the computer's root directory; relative paths don't begin with a slash and filename resolution starts at the current working directory (the value of which is returned by os.getcwd().
 
if i want to save a file using pandas, i would do:

dataframe.to_csv(parent_dir / 'filename.csv')
 
You can save a file in a particular location without having to change the current directory at all (and there are various complex reasons why it's not a great idea to change your current directory that probably won't bite you for another three or four years).
 
To go even one step up i would do:
parent_dir = Path(__file__).parent.parent
 
I'll look it up thanks for the help, it might also be a wget issue cannot deny that.
 
Using pathlib you are just accessing directories relative to your current file, (not changing current working directory), the best part is if you pick up your package and drop it in someother OS, it will still work.
 
5:55 PM
For example, if you want to store a file in the directory that contains the current directory you could save it as "../filename.ext".
But you also need to be clear what wget.download is actually doing.
Your intuition that pathlib is over-complex for your needs is probably correct, though it's a very versatile library.
 
IIRC, wget.download (or some other function) has an optional out parameter that let's you specify where to download your file to
 
I suspect wget.download will store its downloaded file in the current diirectory unless you specify such a parameter. Which is what the second argument would seem to be. It seems wget.download(filename, os.path.join("abc_dir", model_name + '.tar.gz') should do what you want without using the current directory at all.
That will (I am still guessing) save it in the abc_dir subdirectory of the current directory.
 
might also be an issue if it doesn't handle "directory doesn't yet exist" correctly. Sorry I'm in a meeting, so I can't verify my scattered hypotheses as much as I'd like
 
6:25 PM
@AshwinPhadke os.path.dirname(os.getcwd()) gets the absolute path of ... Is that what you wanted in line 9?
 
 
2 hours later…

« first day (3602 days earlier)      last day (1345 days later) »