|
What're my best options for platform-independent MP3 and FLAC playback in Python? I'm writing a media player to serve as a reference implementation for a new metadata format I'm writing, and most of the stuff that handles MP3 or FLAC either a. only works on Windows or b. is bundled in with a bunch of poo poo focused around game development that I'd rather not distribute with my program (like pygame). Right now I'm settled on pyglet (smaller and simpler than pygame at least) but it would be really keen if I just had a teeny-tiny package (or two, for each format) that did nothing but play back media, modulate the volume, etc.
|
# ¿ Mar 24, 2017 14:25 |
|
|
# ¿ Apr 28, 2024 21:40 |
|
All you need is a text editor at this point. Don't worry about getting fancy too quick. (I followed the same book and I and several pros I know recommend it to a lot of people, it's a very good intro) Shaw suggesting Atom is a new one, but I just checked and I guess he's updated it since I last looked at the starting chapters. When you say "framework" I assume you mean an IDE - definitely overkill for you right now (unless you're used to using IDEs with other programming languages - but if you've been programming before, you probably already have a preferred text editor installed)
|
# ¿ Mar 28, 2017 01:19 |
|
funny Star Wars parody posted:Jetbrains makes a lot of really nice stuff and I really like IntelliJ for Java and JavaScript. I found Pycharm to be frustrating to use because most small Python apps aren't organized the way Pycharm seems to try to organize them Personally, I write all my Java in IntelliJ but only larger Python projects in PyCharm - if it's something small I'm A-OK with not having all the fancy features.
|
# ¿ Apr 15, 2017 21:08 |
|
shrike82 posted:There's nothing odd about talking about dependency injection, outside of DI/IoC being slightly less 'popular' in Python-land due to dynamic typing making it trivial to handle. As a relative newbie, if dependency injection is less popular in Python than it is in other languages, how do you handle cases in Python that you'd typically use dependency injection for in, say, Java?
|
# ¿ Apr 20, 2017 20:10 |
|
Thermopyle posted:DI isn't exactly uncommon in Python. It's just that because of Python's dynamic nature you don't really need a lot of scaffolding that you need in other languages so it often doesn't go by the Official Pattern Name Dependency Injection. You just write stuff in Python in a pythonic way and then later someone is talking about Python and DI and you go "you know I guess I just did use DI!" I've tried to figure out super() in Python a few times and everything I look at makes no goddamn sense; do you ? have any good resources covering it? I don't mind doing regular old DI for the project I'm doing in Python it would be nice to properly understand how super() works.
|
# ¿ Apr 21, 2017 01:20 |
|
Trying to install python-tcod on a Linux Mint 18 machine and run into this error when I run "pip3 install tcod":code:
death cob for cutie fucked around with this message at 20:28 on Apr 9, 2019 |
# ¿ Apr 9, 2019 20:26 |
|
I can't learn via video about programming; really, I can't learn from video on any topic at all. I have pretty bad ADHD, so I'll have to rewatch a video 4-6 times to catch it all - more if there's lovely editing, weird jumps, etc. On the other side, I have a ridiculously fast reading speed and I don't have to pause/scrub through a video to get back to what I last understood if I missed something - I just flick my eyes back or go back a page. Video tutorials have gotten better than they used to be, but they're still awful IMO.
|
# ¿ May 3, 2019 04:40 |
|
Please help me understand a Django issue: Python 3.6, Django 1.10* code:
code:
code:
What am I missing? Other uses of session work just fine, nothing seems amiss in my settings or in other places in my project. I thought maybe 'tasks' was somehow reserved and tried different key names; I've tried storing strings, ints, tuples, lists, etc. inside the list in session. I've tried multiple iterations of code and can't seem to pin down anything other than "works in other projects, doesn't work here". I'm wondering if I made some small mistake upfront and I'm just continually missing it? * I teach** intro web development with a company that insists we use Django 1.10 instead of 1.11 for some reason; I appear to have the same problem in 1.11 as well, although I haven't tested as extensively. ** this post may not inspire much faith in my ability to teach - trust me, I'm not having much faith in this today, either
|
# ¿ Sep 12, 2019 04:21 |
|
Thermopyle posted:Keep us updated! Figured it out: the situations in which I was able to mainpulate a list in session no problem, I was also modifying such as an int or string stored in session, adding/removing a key, etc.
|
# ¿ Sep 20, 2019 14:24 |
|
at work we pronounce it "goo-nicorn", no Y sound in there we're also kind of dinguses, tho
|
# ¿ Jun 14, 2020 04:10 |
|
Wait, DataGrip is part of PyCharm? I've been paying for JetBrains Fuckin' Everything for like 20 bucks a month to get both PyCharm and DataGrip
|
# ¿ Jul 2, 2020 01:39 |
|
CarForumPoster posted:The venv folder that pycharm creates is 75MB with only pip20 and setuptools...is that normal? I can't speak for anything else but I just looked at the folder sizes for two virtual environments I have - one has pretty much nothing and is 9.4MB, and one is an environment I use to teach Django and that's 48MB (Django is about 33MB of that). To test something out, I started a new PyCharm project and had it make a venv, and it's 14.9MB. It looks like PyCharm's process for creating a venv in shoving some extra stuff in there. pip list shows not much installed, but some of the folders inside the venv have some extra stuff. I'm not familiar enough with how venvs are made to explain why PyCharm's venv creation inflates the size of the environment, but there's a difference for sure. It shouldn't be 75MB, though. Unless it's a difference of OS?
|
# ¿ Aug 26, 2020 22:06 |
|
Couldn't you just use the functions themselves as dictionary keys? I'm laying in bed and way too lazy to open repl.it on my phone, but I'm pretty sure Python dictionary keys can be any kind of object, including a function - you just wouldn't call it in the dictionary. e: since you're returning the dictionary that sounds non-ideal - you could create a list of function/string tuples and iterate over that; call the first part of the tuple and update the dictionary using the key of the second part death cob for cutie fucked around with this message at 10:07 on Aug 28, 2020 |
# ¿ Aug 28, 2020 10:02 |
|
To be more specific I was thinking something like this:code:
|
# ¿ Aug 28, 2020 22:37 |
|
I think something like re.sub() handles this, but I haven't used it before so I can't provide an offhand example for you
|
# ¿ Sep 2, 2020 21:15 |
|
I assume the cells are merged like that to permit other parts of the document to have cells be merged in other, more horrifying amalgations? gently caress people who don't use spreadsheets for their intended purpose, IMO
|
# ¿ Sep 3, 2020 20:30 |
|
I have what's more or less an academic question: when doing unit testing (via unittest, pytest, nose2, w/e) you're primarily testing based on the output of the function. There's no simple way to test what a function prints to the console rather than what it returns, right? Simple in this case as "able to be explained to a novice programmer, in a way they could grasp without significant difficulty". (This question is pretty dumb, here's the background: I teach at a code bootcamp and want to introduce unit testing to students sooner so they're not making GBS threads themselves when asked about it during a job interview, and most of our early sample functions we have them write are still occasionally printing stuff. I need like, one more reason to cut as many print statements from the curriculum as soon as possible and this could be the tipping point - if a function relies on a print statement to work properly, and we can't test if it works properly, then it's dumb to be using print() while teaching unit tests.)
|
# ¿ Sep 10, 2020 14:17 |
|
Bundy posted:Just to note dicts are ordered as of 3.6. hot drat, they are https://docs.python.org/3.6/whatsnew/3.6.html#new-dict-implementation I was wondering why the last few times I was trying to show that dictionaries aren't ordered to students that it wasn't behaving
|
# ¿ Oct 30, 2020 07:54 |
|
I have the following code I whipped up just out of curiosity:code:
code:
|
# ¿ Dec 9, 2020 18:50 |
|
ooooh, I didn't even think that would be a serious issue
|
# ¿ Dec 9, 2020 20:03 |
|
I just had a student a while back ask me about the maximum integer size in Python, I told her "there's not really one" and she was interested in the implications of that - I literally whipped it together in like ten seconds and threw in len(str(x)) just to indicate how big the numbers would get. Using math.log10 is way better, I'm just a math idiot and didn't realize that was a possibility.
|
# ¿ Dec 9, 2020 20:31 |
|
yeah now that I realize the nature of the issue I'm sure that taking a very, very, very large number and converting it into its string representation is going to be at least a little time-consuming
|
# ¿ Dec 10, 2020 23:00 |
|
I need a confirmation that my hunch is right here, as it's Python-related but involves some stuff I don't normally have to think about : I teach a Python web development course that uses bcrypt - CFFI is a dependency of bcrypt. I have a student on the new M1 Mac who, when running a Django project where bcrypt gets imported in views, gets a nice long exception that terminates with this: code:
(it feels like the obvious answer is "yes, she's boned" but I also feel like I'm missing something here)
|
# ¿ Mar 24, 2021 21:46 |
|
I guess there's also having her run it under Rosetta but that's kind of tedious
|
# ¿ Mar 24, 2021 22:00 |
|
Python GUIs: tkinter is still not great to work with, right? What's the good poo poo for making a semi-decent cross-platform GUI without giving yourself hives, PyQt? guizero?
|
# ¿ Apr 8, 2021 19:15 |
|
CarForumPoster posted:What's the use case? Good question: there's someone who wants a desktop version of VARIA, the Super Metroid randomizer. You can run it from the command line but not everyone is like, comfortable with that, so I figured I'd take the time to learn how to make a decent Python GUI and package the whole thing as an .exe for ease of use. I could probably cram it all into an Electron app but I'm more interested in using this as an excuse to learn a GUI toolkit than I am in learning how to get Electron going.
|
# ¿ Apr 8, 2021 21:43 |
|
Agreed, more or less, but there's a few people who seem to want it for one reason or another (unstable/metered internet connection or frequent travel) and it's giving me a good excuse to poke at some stuff relating to the project I'm interested in.
|
# ¿ Apr 9, 2021 03:27 |
|
skull mask mcgee posted:musicbrainz picard is built using Python and PyQt and it’s no more difficult to install and use than any other software I’ve used Oh hey I use Picard for FLAC file management, neat! anyways I'm sorry to have summoned this tedious conversation into existance
|
# ¿ Apr 10, 2021 23:28 |
|
So I was helping a student fix a project and ran into a really confusing bug that I went in circles trying to figure out. It's solved, but now I come to the thread to ask this: Is there any valid reason to put something like a @classmethod decorator on a class's __init__ method? Or any decorator, really? I really thought the interpreter would have had some special stuff in it for making sure those methods didn't get decorators thrown on them.
|
# ¿ May 24, 2021 21:41 |
|
That makes some sense, thank you.
|
# ¿ May 24, 2021 22:06 |
|
NinpoEspiritoSanto posted:Please please learn from anything other than Learn Python the Hard Way. Author doesn't even understand python 3 properly. I know people had some opinions about Zed Shaw, mostly because he has a lot of opinions that he can't seem to keep his mouth shut about, but what about the book is improper re: python 3? I learned my basics from the Python 2 version and flipped through the third, and at the time nothing stood out to me.
|
# ¿ Jul 20, 2021 00:13 |
|
I want to write a traditional console roguelike in Python. Originally I was going to not bother using an actual console and just use libtcod, but the documentation is way worse than it used to be and figuring out event handling is kind of frustrating me - I wanted to do an actual 80x24 console to begin with anyways, the kind of thing you could play remotely over SSH if so inclined. Python has curses built in, but...quote:The Windows version of Python doesn’t include the curses module. A ported version called UniCurses is available. You could also try the Console module written by Fredrik Lundh, which doesn’t use the same API as curses but provides cursor-addressable text output and full support for mouse and keyboard input. I'd like this in theory* to be playable on Windows. Unicurses has kind of inadequate documentation that is just gonna have me look at the C documentation a lot, which isn't great but is livable. The Console project linked is a dead webpage - someoneupdated it to Python 3, but there's no documentation and if I have to dig through the source to understand everything I may as well just use libtcod. Anyone have a suggestion of what to use, any package suggestions? Or will I just do it in Linux anyways and save letting Windows people play it until I get a webserver going? (* really I wanna do it through a browser, like how DCSS's webtiles servers work, alongside ssh, but getting an actual playable game first might be a good idea)
|
# ¿ Aug 8, 2021 00:04 |
|
Raygereio posted:Anyone have recommendations for terminal/text UIs? I did ask about this earlier (and sadly I don't think the posted ones really solved my problems - I decided to just go with libtcod since it has some useful built-in pathfinding stuff and rather than do essentially an actual tty/ssh connection in-browser I can just squirt the game state to the browser as JSON or w/e) and after looking into them/fiddling for a bit I think Rich and Urwid seem to be the simplest/quickest to get going with - although it's worth noting I didn't do much other than read some documentation and real quickly do some experiments)
|
# ¿ Aug 16, 2021 16:18 |
|
CarForumPoster posted:#1 also this is really good to point out (all of them were good) , just wanted to say I pointed out the existance of f-strings to someone I work on a project with who's not natively a Python programmer and her response was "hell yeah, this is awesome"
|
# ¿ Aug 16, 2021 16:19 |
|
I have a student who's interested in using Python to explore cybersecurity/penetration testing/etc. which is a field I don't know much about. Does anyone have any recommendations for books, sites, etc. on the topic - ideally ones aimed at the introductory level? I asked another group I'm in and got two links to dead blogs about Kali Linux, a collection of dead git repos, and some pentesting frameworks with lovely documentation. So, to clarify, I'm looking for real novice-level material - maybe something a 200-level CS student with some Linux background could digest? e: I've heard good things about Grey Hat Python, and I know that's super old - but Black Hat Python by the same author is semi-recent, would that be an okay start?
|
# ¿ Aug 20, 2021 03:27 |
|
It sounds like you've determined Django would be absolute overkill for your needs, but it's worth noting for future reference that a django-admin created barebones project is configured with a sqlite3 database, no muss no fuss.
|
# ¿ Aug 26, 2021 03:35 |
|
Gin_Rummy posted:I have a music synthesizer app I created, which pulls up a GUI off of a single .py file, and I am trying to figure out the best way to port it into a webpage. From what I understand, Flask will take the return values of Python functions and whatnot I feed it then return it to a webpage... but if my app doesn't really have a return value, I can't use Flask, right? Do I need to just rebuild my app entirely in another language like Javascript, or can I use more advanced functionality of Flask/another framework to translate my app? I mean, depending on what the app is doing, you can just pass the data into a function that does your synthesis stuff, and if it's just creating a sample and storing it on disk or whatever Flask can just return a redirect to whatever page you started at. I'm imagining something like a sequencer/live synthesis, though, and that you'd probably want to just reimplement in JS if you want it to be an actual website... if you're just using Flask because you don't like any of the Python GUI toolkits, though, it can just run a local server and do whatever.
|
# ¿ Sep 1, 2021 22:01 |
|
QuarkJets posted:I thought the whole point of flask was not having to write your app in javascript, have I been led astray? Flask handles the back end. If you wanna do something fancy on the client ('fancy' meaning anything more than puke out a template and some static files), that's gonna be JavaScript. Or, you know, something else. Like Brython. (which is... JavaScript when you get down to it) skull mask mcgee posted:Lol maybe don’t open your post with “y’all are nuts” when making assertions about a domain you have no knowledge of if you’re looking for a polite response. If we were talking 'synthesizer' like 'speech synthesizer', just generating samples, a simple web app would be fine. If you're looking to do some live knob-tuning or whatever like you would with a VST or a real-deal instrument, even something like a connection via a socket is gonna be dogshit. Like, it's possible, but... Gin_Rummy posted:Also this is mainly a learning exercise for myself. Just cobbling together a solution isn't so much what I'm interested in, as I am really just trying to properly learn to how to code with and implement my code into frameworks. Good news - if you want, you can still get Flask involved in here. It might be overkill, but maybe you forsee a future where you want to save patches or sequences to the database for later access from another machine?
|
# ¿ Sep 2, 2021 08:35 |
|
Gin_Rummy posted:Definitely both, but emphasis on the former as my primary focus. Sounds like I can develop a bit of back-end development skills by working on the former, though? I'd focus on one thing at a time - figure out how to do what you want in JavaScript, then think about how to pipe that data from the client to the server to do whatever with it.
|
# ¿ Sep 3, 2021 00:59 |
|
|
# ¿ Apr 28, 2024 21:40 |
|
alexandriao posted:Has anyone ever written an interface to SA in python? It's probably not exactly what you're looking for, but Votefinder (a tool the Mafia community here uses to help run games) has quite a bit of code to download/parse SA posts and reply to certain threads. If you're looking to do something specific and need inspiration, you might want to poke around here.
|
# ¿ Sep 5, 2021 23:03 |