Python

7746 readers
1 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 2 years ago
MODERATORS
276
 
 

This is slyautomation and I am thrilled to welcome you to this in-depth tutorial where we will unravel the intricacies of training an aimbot using the cutting-edge YOLOv8.

277
278
279
280
 
 

This happens if I use set_time or set_position. Is this typical, or am I just not doing it right?

This is on a Pi Zero 2 W, so not the most powerful, but should be able to handle this.

These are the relevant bits of how I'm setting up the player:

    self._vlc = vlc.Instance()
    self._player = self._vlc.media_player_new()
    self._list_player = self._vlc.media_list_player_new()
    self._list_player.set_media_player(self._player)

    playlist = self._vlc.media_list_new()
    for index in self._play_order:
      playlist.add_media(self._vlc.media_new_path(self._songs[index]))

    self._list_player.stop()
    self._list_player.set_media_list(playlist)
    self._list_player.play()

And trying to seek is just this:

    self._player.set_time(_s_to_ms(seconds))

Any ideas would be greatly appreciated!

281
 
 

Hi, I want to know what is the best way to keep the databases I use in different projects? I use a lot of CSVs that I need to prepare every time I'm working with them (I just copy paste the code from other projects) but would like to make some module that I can import and it have all the processes of the databases for example for this database I usually do columns = [(configuration of, my columns)], names = [names], dates = [list of columns dates], dtypes ={column: type},

then database_1 = pd.read_fwf(**kwargs), database_2 = pd.read_fwf(**kwargs), database_3 = pd.read_fwf(**kwargs)...

Then database = pd.concat([database_1...])

But I would like to have a module that I could import and have all my databases and configuration of ETL in it so I could just do something like 'database = my_module.dabase' to import the database, without all that process everytime.

Thanks for any help.

282
 
 

So, I have a python script I'd like to run from time to time from the CLI (on Linux) that resides inside a venv. What's the recommended/intended way to do this?
Write a wrapper shell script and put it inside a $PATH-accessible directory that activates the virtual environment, runs the python script and deactivates the venv again? This seems a bit convoluted, but I can't think of a better way.

283
 
 

Neato

284
 
 

Twitter user @DanyX23:

TIL: pyright, the python type checking engine that is used by VS Code, has support for exhaustiveness checking for match statements with union types!

If you add the following to your pyproject.toml, you'll get the attached warning

[tool.pyright] reportMatchNotExhaustive = true

285
 
 

Not sure if this is allowed here, and it's not my playlist, but I thought I'd post these tutorials since I've found them helpful for learning the basics.

286
 
 

Hi there 👋, I’m Gerard, founder of Latitude.

I have written an article on how I approached building an open-source data tool. I had doubts about Python vs JavaScript, but I’m happy with the path I chose.

Would love it if you guys give me any feedback!

287
288
2
submitted 2 years ago* (last edited 2 years ago) by rimu@piefed.social to c/python@programming.dev
 
 

If you care about performance, you may want to avoid CSV files. But since our data sources are often like our family, we can't make a choice, we'll see in this blog post how to process a CSV file as fast as possible.

289
290
1
submitted 2 years ago* (last edited 2 years ago) by ebits21@lemmy.ca to c/python@programming.dev
 
 

Previously LGPL, now re-licensed as closed-source/commercial. Previous code taken down.

Commercial users pay $99/year, free for personal use but each user has to make a free account after a trial period.

291
292
293
 
 

I want to write my python code using thonny, but I seem to be getting some error when trying to open a file in thonny (Ctrl + O) and when instantiating a window, for example with TKinter. The exact error can be found here:

17:21:40.785 WARNING thonny.ui_utils: Zenity returned code 255 and stderr 'Diese Option steht nicht zur Verfügung. Bitte verwenden Sie »--help« für alle Anwendungsmöglichkeiten.\n' The text is german and says "This option is not available. lease use --help for viewing all options". For now I'll just use vim instead, but I really wanna go back to thonny. Has anyone ever experienced something like this before?

In case it matters, here is output I get from the terminal when running the program on startup:


17:25:36.099 INFO    thonny: Thonny version: 4.0.1
17:25:36.099 INFO    thonny: cwd: /home/marty
17:25:36.099 INFO    thonny: original argv: ['/usr/bin/python3', '/usr/bin/thonny']
17:25:36.100 INFO    thonny: sys.executable: /usr/bin/python3
17:25:36.100 INFO    thonny: sys.argv: ['/usr/bin/thonny']
17:25:36.100 INFO    thonny: sys.path: ['/usr/bin', '/usr/lib/python311.zip', '/usr/lib/python3.11', '/usr/lib/python3.11/lib-dynload', '/home/marty/.local/lib/python3.11/site-packages', '/usr/local/lib/python3.11/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.11/dist-packages']
17:25:36.100 INFO    thonny: sys.flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0, dev_mode=False, utf8_mode=0, warn_default_encoding=0, safe_path=False, int_max_str_digits=-1)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/thonny/__init__.py", line 235, in launch
    _delegate_to_existing_instance(sys.argv[1:])
  File "/usr/lib/python3/dist-packages/thonny/__init__.py", line 322, in _delegate_to_existing_instance
    sock, secret = _create_client_socket()
                   ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/thonny/__init__.py", line 365, in _create_client_socket
    client_socket.connect(get_ipc_file_path())
ConnectionRefusedError: [Errno 111] Connection refused
17:25:37.820 INFO    thonny.plugins.cpython_frontend.cp_front: Creating LocalCPythonProxy
17:25:37.820 INFO    thonny.running: Starting the backend: ['/usr/bin/python3', '-u', '-B', '-m', 'thonny.plugins.cpython_backend.cp_launcher', '/home/marty'] /home/marty
294
295
 
 

I have developed a project in #python to follow #RSS feeds and send an email with daily news. It is more an excuse to practice python, git and design patterns than a real project, but feel free to use it if you find it useful. Suggestions, opinions and feedback are welcome.

https://github.com/xurxia/newswave

296
297
298
299
300
 
 

Welcome to c/Python, the go to place to discuss Python tools, techniques, and news.

We're just getting started, so please use this thread to suggest what this community should look like, what it should cover, and how it should operate.

view more: ‹ prev next ›