#unix
1 messages · Page 6 of 1
You mean, other than calling time.process_time()? Let's back up, what are you trying to accomplish?
I need this function in golang
https://github.com/python/cpython/blob/2cd1c87d2a23ffd00730b5d1648304593530326c/Modules/timemodule.c#L1344 there it just adds utime and stime
Modules/timemodule.c line 1344
_PyTime_t total = utime + stime;```
So that would be correct, right?
Well, it is utime+stime, but it's getting it from getrusage, not from procfs
But sure, I suppose getting it from procfs works too, at the expense of portability
Portability is not a problem, only needs to run on Linux
Are the values from getrusage and procfs the same?
I believe there is also a wrapper for getrusage in Go
They should be, though getting them from procfs will be (slightly) slower
Should be fine
Does anyone use Python CLI tools which are annoyingly slow? E.g. I find the AWS CLI annoying, it never responds in less than about half a second.
yes, poetry
unrelated but I just did speed testing on curl vs wget vs certutil vs other system commands and never realized how slow curl is relatively
Do you mean Poetry is slow in things like resolving dependencies, or just slow to respond in general?
for my raspberry pi it takes a couple minutes for poetry to resolve dependencies, which is my main gripe with it
but looking at other commands they all seem to have about a 1s delay minimum
the main bottleneck for a recent CLI i made was the imports so i had to work around it by moving imports inside functions and not importing certain submodules in __init__.py
well, modifying list of installed packages is basically most of its job. I can understand it relies on connection for that. Other like "env list" is good. Still annoyingly slow when updating package list 😅
one way to quickly profile how long imports take: python3 -v 2>&1 | ts -i "%H:%M:%.S"| grep '.*import'
Anyone knows if there is a way to usee the 'ping' command through python?
@misty meteor https://pypi.org/project/ping3/
Thank u so much!
woa neet
Why not subprocess.run(["ping", ...])?
Curious why you ask. Are you investigating something or just trying to find some comfort in knowing others deal with the same problem?
Because of jumpthegun, I assume :)
Indeed, for my latest project JumpTheGun, I'm trying to gauge interest and find areas where it can be most useful.
Ah, that seems like exactly what JumpTheGun could solve for you! Next time you're working on a CLI and have such issues, I'd be happy if you considered it.
github.com/taleinat/jumpthegun
in my opinion AWS CLI will not be improved by any kind of CLI interface
https://gist.github.com/jboner/2841832
Because network latency is unavoidable
network communicating CLI is a network communicating CLI
it is not really for python to solve it
plus, there is already perfect tool for CLI tools, named Golang.
Any tool is made as fast as possible, lightweight as possible, with minimum dependencies, and maximum possible multihtreading if necessary and at the same time as maintainable as possible.
kind of no point for smth else in terms of CLI, if u already learned golang in my opinion
i choose for CLI not golang, only if projects are written in another language and i am forced to choose another language
@wise forge
in my opinion AWS CLI will not be improved by any kind of CLI interface [...] because network latency is unavoidable
Yes, JumpTheGun isn't going to resolve network latency, but it can avoid long startup times, which are often an issue even without network latency.
plus, there is already perfect tool for CLI tools, named Golang.
I have two main responses to this:
- The effort to rewrite many such tools in Go (or Rust etc.) would be immense. In some cases it is worth it, see for example Ruff, but those are the exception to the rule. JumpTheGun makes existing tools faster with zero development or maintenance effort.
- The first time I ran into such an issue was actually with a CLI tool written in Go, which did not suffer from network latency: go-license-detector. It simply does a lot of setup every time it is run. I ended up forking it and creating a version which worked as a simple HTTP server; with something like JumpTheGun I could have trivially done something similar with zero development.
https://github.com/go-enry/go-license-detector
have u measured time for startup of AWS CLI in comparison to network delays? have you run profiling?
comparing network delays with startup times is supposed to be many times different values
i would expect, network delays being way higher to notice any startup delays
I have measured the startup of the AWS CLI with an without JumpTheGun, and on my machine it went from ~450ms to under 200ms, nearly 3x faster.
eh, and the tool works without rewriting code base. yeah, sure. great thing
although to be honest, for my human eye, 250ms is not very noticable
That depends on the specifics of your networking, where you are in the world relative to the AWS region, etc. However, it's not unreasonable for a simple query to require a single back-and-forth, and that can take well under 100ms. Compared to that, an extra 450ms of startup time is massive.
i am more horrified by Java CLI tools delays... their delays are measured in seconds...
Maybe Java should be my next target language then 😎
if u will make Gradle working faster, it will be amazing
Java ecosystem has no choices. Maven and Gradle
slow as f stuff for any, any command launch
launching unit tests, is many many seconds adventure for hello world program
Ah, yes, launching tests is a great use case! I'm aiming to do something about that for pytest to making running tests as near-instant as possible.
(It already shaves off ~100ms of every run of pytest, but there's likely more that can be achieved.)
have u tried running it with integration to vscode? checking visual debug is working during test launch?
Not yet, but I don't use VSCode. Still, whether it could be used with a debugger attached is an excellent question. At the moment I don't think that will work, unfortunately.
naa@naa-MS-7C89:~/repos/pet_projects/darklab_avorion_api$ grad test
BUILD SUCCESSFUL in 2s
19 actionable tasks: 9 executed, 10 up-to-date
naa@naa-MS-7C89:~/repos/pet_projects/darklab_avorion_api$ grad test
BUILD SUCCESSFUL in 672ms
19 actionable tasks: 19 up-to-date
launching tests for hello world
first launch 2s, second launch 672s
for hello world, Carl!
How to make a command? Have different permissions everytime?
Like when running a command how to specify for only that time it is ran it has only read permissions?
There's probably a better way to solve whatever you think you're trying to solve here... You would probably need to create a read only user and su with that, unless the specific command has a read only option
To answer your question directly, you would use chmod to change permissions of a file
So i was just messing around slightly and this issue kept popping up
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.11/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
Which made me use a venv instead
That was fine till I had to use a jupyter notebook for a project, for some reason the venv never really worked for vs-codes jupyter notebook extension
----> 1 import pandas as pd
ModuleNotFoundError: No module named 'pandas'
I kept getting this so I just ended up
sudo apt remove python3
Than reinstalled it, hoping that would fix it but same issue
Now kinda out of ideas in fixing it
The same issue also pops up in jupyter-notebook
Ik what chmod is but like give certain permissions to a command when executing like different permissions per execution
Why would you want that?
I do not want it was just curious if there was a way
sudo apt install python3-packageName
This solution works for now but is there a better way to fix the train-wreck that's known as the external environment
You should definitely be using a virtual environment of some sort instead of messing up your system. See if this helps? https://stackoverflow.com/questions/58119823/jupyter-notebooks-in-visual-studio-code-does-not-use-the-active-virtual-environm
This helps a lot thanks
Is there a way to pass a specific file descriptor to a process using subprocess? I see the pass_fds argument but you can't remap file descriptor numbers with it, only pass them through
I have a script that expect something as fd 7, this is done currently from another shell script (using 7>), I want to rewrite that script from bash to Python
I can call dup2 but there might already be something as fd 7, really I want to to dup2 after fork and before exec, but preexec_fn seems deprecated, I'm not sure how to do this
I just want to translate cmd 7> output.log to Python Popen(['cmd'], ???)
Hello guys and girls.
any ideas how to fix this (whatever the reason) ?
im not familiar with python (just average 3d designer) but i ran in such issue when tried to launch UI for image generator.
in other words i would appreciate any help with installing missing dependencies - tried allready on my own but i failed
PS. Running on latest fedora linux
If you're not a developer, this shouldn't be your problem. Report it to whoever maintains the install script.
What is Unix?
It's an operating system. Or rather, a whole swathe of operating systems that conform to a similar set of ideas and ideals. Linux is a Unix operating system (or at least Unix-like), BSD is another, and there are many realtime OSes which are Unixen or Unix-like
Unix (; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and others.Initially intended for use inside the Bell System, AT&T licensed Unix to outside parties in the lat...
i use endeavourOS btw
Got any shell experts here? Is there a more concise way, that doesn't use the temp variable to do this sort of variable expansion?
export foo1=2
export num=1
echo $(tmp=foo$num; echo ${!tmp})
It does what I want but I'm trying to use this in qsub command being submitted through drmaa python interface
what shell are you using? POSIX sh doesn't have ${!tmp}, so you must be using bash or ksh or something?
Bash my good sir
can you explain in simple English what it does? 😕
[also, if at all possible, do that computation in Python, not shell]
You can have arrays in bash...
https://stackoverflow.com/a/11856262 has an example using a variable as an array index, too.
Cannot export arrays or associated arrays and this needs to be evaluated by the shell before it's passed to qsub to be ran on a SGE cluster
The bane of all programmers - incomplete or unclear or just downright misleading requirements.
can you elaborate? I don't think I understand, still. What's using the environment variables? The shell itself? What's setting them?
maybe you're looking for ```bash
export foo1=2
export num=1
declare -n the_foo="foo$num"
echo "${the_foo}"
hello, im using ubuntu wsl and i am tryna uninstall python3.10.6 and install python 3.9 instead, how do i do this?
The deadsnakes PPA lets you install multiple Python versions on your Ubuntu system, so instead of only having just the Python 2.x and Python 3.x that comes with your distribution (18.04 comes with Python 3.6, and 2.7 is available), you can install older or newer versions, from 2.3 (!) to 3.8! The way PPAs (Personal […]
i get this error: add-apt-repository: command not found
huh, I have that binary
❯ whence add-apt-repository
/usr/bin/add-apt-repository
❯ apt-file search add-apt-repository
software-properties-common: /usr/bin/add-apt-repository
this is Ubuntu 22.04 "Jammy"
well, "apt-file" itself is not installed by default. But "software-properties-common" sure sounds like it ought to be installed by default
huh, good
So everything I define, needs to be exportable because qsub will export the current shell environmental variables when submitting the executable (in this case a python script) to the Sun Grid Engine cluster.
So associative arrays and arrays are out of the picture
I'm gonna be making a full blown stack overflow post with more info because I cannot access discord at work
well, does the declare -n option I suggested work?
ok now im getting module distutils.cmd not found when i try to pip install
i have a feeling my ubuntu corrupted cause now apt-get install isnt working
its giving some lock error
what error?
how did you run pip? Do you have the appropriate pythonX.Y-pip package installed?
Pythonx.y -m pip install
ok, and what error are you getting here?
did you install the pythonX.Y-pip package via apt-get?
I fixed it with a restart
ok, so try doing sudo apt install pythonX.Y-pip and see if that helps anything
I've seen that as a solution but I think I have a bigger issue and this is a red harring. https://unix.stackexchange.com/questions/747692/shell-variable-expansion-in-qsub-command-through-drmaa
Is the above, better defined?
you switched from bash to zsh?
Yes, but the shell scripts are functionality equivalent
My shell at work is zsh, home is bash
what do you see if you do: py task_id_env_vars = {"foo": "bar"} and ```py
template.outputPath = f":{INPUT_BASE_DIR}/output/$foo$TASK_ID.o"
template.errorPath = f":{INPUT_BASE_DIR}/error/$foo$TASK_ID.e"
I have a guess that this might result in files being created named $foo1.o and $foo1.e - and if so, that would strongly suggest to me that the $SGE_TASK_ID isn't being expanded by the shell at all, but by something else
I've never used (or even heard of) SGE before, but my educated guess is that it's expanding the $SGE_TASK_ID in the output filename itself, and then using the rest as a literal string, without the shell having any ability to further expand it
https://docs.oracle.com/cd/E19957-01/820-0699/i999036/index.html says:
To build custom but unique redirection file paths, use dummy environment variables together with the qsub -e and -o options. A list of these variables follows.
HOME – Home directory on execution machine
USER – User ID of job owner
JOB_ID – Current job ID
JOB_NAME – Current job name; see the -N option
HOSTNAME – Name of the execution host
TASK_ID – Array job task index number
The use of the word "dummy" there strongly suggests to me that you can't use arbitrary variables, and instead only these fake variables can be used - and if they're "dummy", the shell wouldn't be able to expand them, so SGE must do so itself
Ah
This is horribly disappointing
well, it's just an educated guess at this point - but it's the only way I can think of that you could have wound up with $(tmp=SUFFIX_TASK_ID1; echo ${(P)tmp}).e as a file name - I can't think of any way that the shell could have expanded one of the $ and not the other 2.
I'm not at work so I cannot answer your question.
Looking over those docs I see these too things.
SGE_O_SHELL – The content of the SHELL environment variable in the context of the job submission command.
SHELL – The user's login shell as taken from the passwd file.
Note –
SHELL is not necessarily the shell that is used for the job.
I don't recall what SHELL was but I recorded SGE_O_SHELL in the SE post. Maybe it's executing it as a different shell...I can only hope
I'm not specifying the -S option
I am looking to automate the creation of ubunutu machine images using Packer, however while executing commands like "sudo apt-get upgrade" I'm both asked to enter Y/n and to restart services. Are these things going to interfere with the commands sent in Packer? If so, how could I set the default behavior/bypass them?
You've tried and encountered this problem or are you just speculating that this could be an issue?
I haven't used Packer but if it can't handle such a basic thing I can't imagine what the point of it would be.
https://stackoverflow.com/questions/33370297/apt-get-update-non-interactive
U need to Google
"Debian not interactive apt upgrade"
Not a packer fault, it was made to be CLI
Just something I noticed while trying a dry run manually executing everything myself. I also tried the export command and it didn't seem to actually do anything
https://askubuntu.com/questions/1364742/how-to-do-apt-upgrade-with-noninteractive
More recent version applicable
I'll give that a shot, thanks!
Nice!! That's real simple, I like it
ty
I do mine with two colours because it looks cyute
Fancy shmancy
Fency Shmency
So....is fencepost your alter ego? The thing that causes offby1?
It's my "someone already got the name offby1" ego
probably this guy https://twitter.com/offby1
bastard
How would I go about deactivating my venv from a new shell?
I am running my code on an Ubuntu VPS and when I deploy to my github I have the server automatically update.
This is the command I am currently using to start my code in a venv and also not require the terminal to stay open at all times.
source discord_bot/bin/activate && nohup python bot/main.py & echo $! > bot.pid
This is how I am stopping the bot before I update it
kill -2 bot.pid This will leave the venv still running though.
it will?
Nevermind. I am like 85% sure this did not work before now it almost does. It is storing the pid of the venv and not the python code
is it okay to kill the venv? I know kill -2 allows for a clean way to kill python with KeyboardInterupt
do you mean "is it okay to kill the shell"?
I think that's what you're currently doing anyway
Still storing the wrong pid though.
414010 pts/0 00:00:00 bash
420290 pts/0 00:00:00 bash
420291 pts/0 00:00:00 python
420304 pts/0 00:00:00 ps
bot.pid: 420290
When I kill the python the second bash dies with it.
don't use nohup for deployment, be a man and use systemd
https://linuxhandbook.com/create-systemd-services/
put config /etc/systemd/system/service_name.service with configurations
and run it as sudo systemctl start SERVICE-NAME.service (optionally enable its autolaunch)
on stop it will stop
that is vanilla linux solution
if u want to be especially cool and modern, use docker to run your services
docker run --name my_service -d image_name, that will be enough to launch it in background
docker stop my_service to stop, and docker rm my_service to erase
Why would I want Docker ontop of my VPS?
source discord_bot/bin/activate && nohup python bot/main.py & echo $! > bot.pid
also u can run it as
/path_to_python/bin/python bot/main.py
that will make not required venv activations despite using venv
capturing your application system level dependencies into it
+having frozen its python dependencies in addition (kind of alternative to lack of compiling)
ability to build and test once, and deploying already confident being valid application
easier env spin up for local dev and reduce "but works on my machine" cases
systemctl --user enable surveywolfbot.service
Failed to connect to bus: No such file or directory
start with systemctl start surveywolfbot
.service is automatically ommited from name
still same error
systemctl --user start surveywolfbot
what yields ls /etc/systemd/system/surveywolfbot.service
also could u remove --user from your command
I put it in ~/.config/systemd/user/ as per the tutorial you sent
That requires root access
do it with root access then
when u will grasp how to use it with root
feel free to modify to work without
Failed to start surveywolfbot.service: Unit surveywolfbot.service not found.
ls /etc/systemd/system/surveywolfbot.service ?
Not found
make file with configs available at /etc/systemd/system/surveywolfbot.service
now it does not give any errors but it does not appear to be running
systemctl status surveywolfbot for short logs
https://www.digitalocean.com/community/tutorials/how-to-use-journalctl-to-view-and-manipulate-systemd-logs
journalctl -u surveywolfbot.service for full logs
see variations of command in a guide
Xcode updates for Apple M1 broke my Django projects. (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')) I have arm64 installed. “ arch command returns ‘arm64’ on the terminal ”. How can I re-build my projects using ‘arm64’?
Ok, it is now running via root. How do I go about running it without root? Do i need to give permissions to a specific folder/file/command to my user?
Also it does not seem to be running in my venv with this command
/home/statwolfbot/discord_bot/bin/python3.10 /home/statwolfbot/bot/main.py
It is not properly accessing the environment variables.
define env vars in systemd config too
https://www.flatcar.org/docs/latest/setup/systemd/environment-variables/
[Service]
# Client Env Vars
Environment=ETCD_CA_FILE=/path/to/CA.pem
Environment=ETCD_CERT_FILE=/path/to/server.crt
Environment=ETCD_KEY_FILE=/path/to/server.key
Is there somthing similar I have to do to set up the DNS server? I cannot connect to outside websites
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host discord.com:443 ssl:default [Temporary failure in name resolution]
Wow, do we have this channel? 😮 hello!
where do i download the apt-pkg for python 3.9
What does apt show python3 show you?
shows version 3.10
What about apt show python3.9?
Wow, do we have this channel? 😮 hello!
great, apt install python3.9, you might need sudo
i did but still get ModuleNotFoundError: No module named 'apt_pkg'
oh, I misunderstood your question
you want to interact with apt in your python code?
i wanted to download heroku and got this error
i wanted to download heroku and got this error
tried installing apt-pkg specifically but got this
answer depends on which cloud provider u a using
As in hosting provider?
The thing is ping -c 4 discord.com works just fine
[Unit]
Description=Survey Wolf Bot
After=network-online.target
[Service]
ExecStart=/home/statwolfbot/discord_bot/bin/python3.10 /home/statwolfbot/bot/main.py
Restart=no
Environment=bot_token=
Environment=db_name=
Environment=db_user=
Environment=db_host=
Environment=db_password=
[Install]
This is my updated file (with passwords removed)
what yields curl https://discord.com?
curl not found :/
I dont know Heroku, did you follow this guide? https://devcenter.heroku.com/articles/getting-started-with-python
I dont know Heroku, did you follow this guide? https://devcenter.heroku.com/articles/getting-started-with-python
I dont know Heroku, did you follow this guide? https://devcenter.heroku.com/articles/getting-started-with-python
I did not reload the service file properly or something. IT seems to be fully working now.
Now i just need to find out how to make it run without root
https://www.cyberciti.biz/faq/how-to-install-curl-command-on-a-ubuntu-linux/
sudo apt update && sudo apt install curl
@woeful flint What are you running when you get ModuleNotFoundError: No module named 'apt_pkg' ?
I will do this in a bit but it does not seem 100% needed now that I reloaded the service file
Now i just need to find out how to make it run without root
the command to download heroku
Now i just need to find out how to make it run without root
good luck ^_^
actually it is very easy
You can specify the directives User= and Group= in the [Service] section of the unit file.
https://www.golinuxcloud.com/run-systemd-service-specific-user-group-linux/
this one better instruction
Did you follow the heroku "Getting Started" guide I linked?
User=deepak
Group=admin
just a matter of adding to [Service] section, few lines
You can specify the directives User= and Group= in the [Service] section of the unit file.
yeah i did
yeah i did
so what command was that, brew install heroku?
no its curl https://cli-assets.heroku.com/install-ubuntu.sh | sh since i'm on ubuntu
oh right, the guide only showed mac and windows
I would investigate which part of the script https://cli-assets.heroku.com/install-ubuntu.sh that comes from. It looks super strange
why would it be running python o.O
oh right, the guide only showed mac and windows
oh right, the guide only showed mac and windows
I miss when heroku had free tier 😢
the latter iirc 🙂
yes, it's a cloud thingy -- someone once described it as "like AWS, but comprehensible"
The term is merger of "Hero" and "Haiku". The Japanese theme is a nod to Matz for creating Ruby.
Thank you for helping me everything seems to be working as it should :)
Anyone noticed that git diff hunk headers for python are kinda broken? Even when turning on the builtin python diff - that one is just bad in different ways 😢
show examples
bug reports without evidence are useless
and preferably with version of OS, software and etc and steps to reproduce it
It's just a git thing, so OS is uninteresting. Yeah I might do a writeup in the coming weeks. It's a bit annoying to collect examples. Was hoping that someone else had already done an inventory.
Perhaps anyone has gotten tips about how to effectively collect hunk header examples. My idea approach would be:
- Produce example python code with classes/methods/multiline strings,
commit - Make changes to the code
git diff
repeat 2 about 20 times
do it, at the moment we have even no idea how to recognize it / what to look for.
Sorry, here is some examples and discussion around it: https://stackoverflow.com/questions/2783086/how-does-git-diff-generate-hunk-descriptions
The problem I have seen is with methods inside classes, when there are also multiline strings in the mix. Perhaps decorators can cause problems too.
But a systematic inventory is probably needed to understand it 🙂
what distro do you recommend
If you have to ask, I say it's a toss up between Mint or Ubuntu. But it really doesn't matter and it's a matter of personal opinion, just try anything you like
i am compiling gentoo atm
"whichever distro your favorite cloud provider supports"
which in my case means Ubuntu and AWS Linux
Depends on if they're asking for desktop or server use. Also some cloud providers have "bring your own iso" to install whatever you want
Personally for servers, I like debian. I'm also exited for debian 12 in a few days, there's some nice upgrades and improvements
true; I was thinking for server use
Late to the party.
Debian Stable for desktop and server.
depends on your level, your needs etc etc
i use endeavourOS
which is basically arch linux with gui installer and several other stuff
and im not touching ubuntu since it stinks
what is the difference between a path that starts with backslash and one that dosent in Linux?
i.e. /some_directory/file.txt vs some_directory/file.txt
That's a forward slash. If it starts with one, it's an absolute path (similar to C:\ on Windows), otherwise it's relative.
The difference is that on unix, all drives are mounted somewhere on /; as if D:\ was instead at C:\drives\D\ or something like that.
so you can have multiple paths that have a different root directory on the same machine? how does that work?
oh so / is basically the root node, and you cal always create a new sub-tree under it by adding a new child, is that correct?
No, everything is under the root directory /.
You can "mount" a device under a path inside this structure. Typically, the main disk is mounted at /, and other ones are often under /mnt/some_other_drive
There's a bit of magic here as well: What's at / is not only the main drive, but the kernel also injects other magical directories into / that don't correspond to data on disk, e.g.:
/proc, containing information about running processes/devcontaining "device files" (those are the things you then mount to a different location
I'm not talking about mounting different devices, I'm just trying to understand how this works, cause its kind of like you are adding the path to PATH and you can access it from everywhere, but now I understand that you are placing it under the root node of all paths so it becomes an absolute path that you can access from anywhere.
but how do you create it? because when I do Path('/code').mkdir() it gives me an error (PermissionError: [Errno 13] Permission denied: '/code')
Since / is so important, you can only do that as root
Minor anti pattern in using Path btw
(Path("/") / "code").mkdir()
The point is, that u can insert different root folder to begin path, which can be even windows one. And same code will get into code folder in OS agnostic way
But... with (Path("/") / "code").mkdir() you still hardcode that it's a unix path. If you want it to be injectable, you'll have to change this line regardless. So I disagree about this being an anti-pattern.
😛 but when making it dehardcoded from unix only path, u will need changing only "/" variable to smth else, instead of changing much more code of nested folders and files, since u have already OS agnostic folder moving
less code riples.
AFAIK, either way pathlib will resolve it appropriately
YAGNI, do it when needed
Especially here, where they were explicitly experimenting with a Linux system and how one adds folders to the root.
YAGNI is not applied to everything. if u capture errors handling like
try:
# code
except Exception:
pass
it will be already not a YAGNI to do it better from a start.
silent supress of Exception is not good
it drives me nuts when I see ppl doing:
try:
# some untested code
except Exception as e:
print(e)
does someone have written python script to execute a command in the bash before?
if so, can u share me a code? im trying to make it so i can play my music directly from clicking a file on desktop. i partially succeeded, but its still isnt something i wanted
You should use subprocess.run. there is an example in the doc
https://docs.python.org/3/library/subprocess.html#module-subprocess
yeah, i was using that, but i didnt achieved what i wanted. also, thx!
Can you explain what the problem is?
the script i wrote could only be executed, by writing a command in bash. also,pretty funny fail - i forgot to write a way for me to quit xd but thats okay, i will try using loop
Anything you do in bash should be callable with subprocess. Try subprocess.Popen if you need more control
Subprocess on linux tends to prefer the list form of a command than the string form, too.
Hi, I'm looking for help with a couple of linux libraries at #1118810078422777946 message
If anyone knows how I could get a pyudev observer to make threads to watch devices with evdev, (or if anyone can suggest a better approach) help would be appreciated.
Morning folks, what's the clean way to run CGI scripts these days?
I have a static website and want to add a tiny bit of dynamic content to it. cgi from the stdlib deprecated and I'm on NGINX so only FastCGI is an option anyways.
Would be happy for good alternatives 🙂
Some things I found:
- Twisted's
.rpyfunctionality is very similar wsgirefstill includes a CGI handler that could be used withfcgiwrap
i will try that out, ty!
fr
Hi all, Please refer me to a better channel if my question is better placed there. I have a program that I want to record the peak memory usage. I want to create a line plot with the peak memory. Any recommended libraries to get the peak memory. Ideally, I would be able to reset the peak memory counter during the execution of the program since I have the input sizes programmed as a for loop.
what DE are u using?
emacs
in xfce i think there is already program for that
DE = desktop environment, u dummy
please behave respectfully, I don't appreciate that
💀💀
since when "u dummy" is smth derogatory? but well, im sorry if u didnt liked that
now, if u could answer that question
oh, im sorry. there is actually a de like that. i thought u were referring to text editor
have u tried tracemalloc?
hmm, wrong library
Should i Put Swap before or after /
On a regular rotating HDD it would be faster in the beginning of the disk. Becasue linear read/write is faster at the beginning. For the SSD doesn't matter.
Ok, so I have an odd question revolving around X11, matplotlib qt windows and ipython, I hope this is the right place. I need the x11 window class name (to set a floating window rule in bspwm), if I create a plot from a python terminal this is "matplotlib", but if I do it from ipython its a single space " " and I'm not sure how to set a bspc rule otherwise (I tried on the name, but don't think it supports wildcards "Figure*"). Any ideas?
The problem seems to be specifically with the plt.ion() option, but again, only in ipython...
This ipython -i -c "from matplotlib import pyplot as plt; plt.ion(); plt.plot(0,0)" works and so do subsequent interactive calls to plot, while
this ipython -i -c "from matplotlib import pyplot as plt; plt.ion()" with subsequent plots does not.
I guess for now, as a hack, I can start ipython -i -c "from matplotlib import pyplot as plt; plt.ion(); plt.plot(); plt.close(plt.gcf())" instead of ipython and maybe create an alias.
I've been running sudo mount /dev/sda1 /media/t5 to mount an external drive to an Rpi. The SSD is exFAT. Writing to it from the dan user is impossible, I just get permission denied, e.g. mkdir /media/t5/foo yet prepending sudo works.
Not sure what to do to resolve this, as sudo chown -R dan:dan /media/t5 just spams Operation not permitted.
You can specify the user in the mount options -o user=dan,group=dan (or something similar - I always have to check the mount docs to get the right option format)
I'd also try changing ownership of the mount point before mounting the file system on it
don't honestly know if that'd work, but it should be easy to try
I don't think it does. I recall it being something I used to do, but I think that's for being able to mount, it doesn't affect the perms of the mounted partition
(One of those - got it working, now, leave well enough alone; now forgotten how I got it working - things!)
aye -o uid=1000,gid=1000 worked, tyvm!
You might also want/need to set exec and/or other options
hahahahahahah
no Mac channels here
lol
does anybody here has access to a MacOS machine ??
I want to test something
This channel does include MacOS
Tooling, setup and configuration related to Python development on unix or unix-like systems such as Linux or MacOS.
wow
I thought Unix only refers to linux-ish things
do you guys think this is a good code to determine which OS my app is being executed?
I don't have access to a mac device so I won't know if it's exectuing correctly
Traceback (most recent call last):
File ".../some/dir/test.py", line 1, in <module>
from common.names import *
ModuleNotFoundError: No module named 'common'
@tulip vortex
oh wait
import os
import sys
import time
import random
import subprocess
import traceback
put these instead of the common.name one
Current platform: Darwin
macOS Version:
Build Number:
dam
I think it's because version_info is defined only for windows
do you know the correct way?
funny fact:
in my language, Seaman means cement
under IS_MAC: I'd do:
version_info = platform.mac_ver()
but it won't show the build number
does it show the os version?
it seems that there are three outputs for the mac version
def mac_ver(release: str = ...,
versioninfo: tuple[str, str, str] = ...,
machine: str = ...) -> tuple[str, tuple[str, str, str], str]
can you print them all?
In [1]: import platform
In [2]: v = platform.mac_ver()
In [3]: v
Out[3]: ('12.6.6', ('', '', ''), 'arm64'
here's my output from ipython
MACOS_VERSION
MACOS_BUILD_NUMBER
these are the two I'm using right now
what is the name of the third one
architecture
so I should say MACOS_ARCHITECTURE ?
sure
are they in correct order?
mac_version = platform.mac_ver()
MACOS_VERSION = mac_version[0]
MACOS_BUILD_NUMBER = mac_version[1]
MACOS_ARCHITECTURE = mac_version[2]
print("macOS Version:", MACOS_VERSION)
print("Build Number:", MACOS_BUILD_NUMBER)
print("Architecture:", MACOS_ARCHITECTURE)
yes
though, as you can see above, the tuple for build number was empty
might be different for intel-based macs
maybe it's the case only with your machine
could it be a permission issue-ish thing?
try running the code as sudo
No difference 😄
np!
Does the mac have an /etc/os_release file? Most of that info should be in there, and should be parsed by platform (although the interface in platform has changed over various Python versions)
It does not
There is the sw_vers command though
I've got terminalexia. I've got a terminal in vscode, one in docker app, one in terminal app, screen terminals, python env terminals. Hard to find the right one.
maybe try https://zellij.dev to see if it suits you
Try terminator. Terminal multiplexor
I use default one Konsole from Kubuntu ^_^
tmux 👍🏼
it's hard to get away from from the integrated terminal in VScode when using Platformio
How do i remove Partition 2 and move Partition 3 and make It füll size
there's an old tool https://www.gnu.org/software/parted/ that I think can do that
im trying to run snekbox on my rpi, ive installed amd64 support or well i tried with this command: sudo docker run --privileged --rm tonistiigi/binfmt --install amd64 and then i installed snekbox with this command as per the docs sudo docker run -d --rm --platform linux/amd64 --ipc=none --privileged -p 8060:8060 ghcr.io/python-discord/snekbox, however, i get an error ```
2023-06-26 12:45:43,649 | 13 | snekbox.nsjail | ERROR | Couldn't launch the child process
2023-06-26 12:45:43,671 | 13 | snekbox.nsjail | INFO | nsjail return code: 255``` which leads me to believe theres some shenanigans going on. I would like to know if i should try to mess around with it more or if its just useless to try stuff out because it wont work i also tried to build it locally and run it that way but still doesnt work
i get this error: https://paste.pythondiscord.com/ovadovetet
fdisk can only create partitions and delete them (which will destroy data as well). In case you need to preserve data, use software like GParted, EaseUS, or SystemRescueCd which has GParted included. Also make some backups of the most important files in case partition operations goes wrong.
Could you provide code samples or error messages
Can anyone Help with OpenBSD? I somehow overwrote my Linux Partition and only have a USB with OpenBSD, If i Plug in a USB WiFi Thing, it Shows a blue Message saying it isnt configured
Please mention If Response
That was going to be my suggestion, too ;) Use another machine (or even the same machine if you have two USB ports) to write an ISO liveboot of your distro to a USB stick
[root@archi system]# systemctl status http-drop
× http-drop.service - Dropbox-http
Loaded: loaded (/etc/systemd/system/http-drop.service; enabled; preset: disabled)
Active: failed (Result: exit-code) since Tue 2023-07-04 22:28:06 CEST; 3min 17s ago
Duration: 194ms
Process: 3319 ExecStart=/usr/bin/python3 /home/user/code/filenet.py (code=exited, status=1/FAILURE)
Main PID: 3319 (code=exited, status=1/FAILURE)
CPU: 189ms
Jul 04 22:28:06 archi systemd[1]: http-drop.service: Scheduled restart job, restart counter is at 5.
Jul 04 22:28:06 archi systemd[1]: Stopped Dropbox-http.
Jul 04 22:28:06 archi systemd[1]: http-drop.service: Start request repeated too quickly.
Jul 04 22:28:06 archi systemd[1]: http-drop.service: Failed with result 'exit-code'.
Jul 04 22:28:06 archi systemd[1]: Failed to start Dropbox-http.
Trying to run an Tornado web server
this is on arch linux
[root@archi system]# journalctl -u http-drop
Jul 04 22:28:01 archi systemd[1]: Started Dropbox-http.
Jul 04 22:28:03 archi python3[3313]: Traceback (most recent call last):
Jul 04 22:28:03 archi python3[3313]: File "/home/user/code/filenet.py", line 61, in <module>
Jul 04 22:28:04 archi python3[3313]: app.listen(100)
Jul 04 22:28:04 archi python3[3313]: File "/usr/lib/python3.11/site-packages/tornado/web.py", line 2134, in listen
Jul 04 22:28:04 archi python3[3313]: server.listen(
Jul 04 22:28:04 archi python3[3313]: File "/usr/lib/python3.11/site-packages/tornado/tcpserver.py", line 183, in listen
Jul 04 22:28:04 archi python3[3313]: sockets = bind_sockets(
Jul 04 22:28:04 archi python3[3313]: ^^^^^^^^^^^^^
Jul 04 22:28:04 archi python3[3313]: File "/usr/lib/python3.11/site-packages/tornado/netutil.py", line 162, in bind_sockets
Jul 04 22:28:04 archi python3[3313]: sock.bind(sockaddr)
Jul 04 22:28:04 archi python3[3313]: PermissionError: [Errno 13] Permission denied
Jul 04 22:28:03 archi systemd[1]: http-drop.service: Main process exited, code=exited, status=1/FAILURE
Jul 04 22:28:03 archi systemd[1]: http-drop.service: Failed with result 'exit-code'.
eh
thanks for helping ig
ill try to figure out the rest on my own
thanks
it gave me a lecture
💀
Jul 04 22:42:54 archi sudo[3919]: pam_systemd_home(sudo:auth): systemd-homed is not available: Unit dbus-org.freedesktop.home1.service not found.
Jul 04 22:42:54 archi sudo[3919]: pam_unix(sudo:auth): conversation failed
Jul 04 22:42:54 archi sudo[3919]: We trust you have received the usual lecture from the local System
Jul 04 22:42:54 archi sudo[3919]: Administrator. It usually boils down to these three things:
Jul 04 22:42:54 archi sudo[3919]: #1) Respect the privacy of others.
Jul 04 22:42:54 archi sudo[3919]: #2) Think before you type.
Jul 04 22:42:54 archi sudo[3919]: #3) With great power comes great responsibility.
Jul 04 22:42:54 archi sudo[3919]: For security reasons, the password you type will not be visible.
Jul 04 22:42:54 archi sudo[3919]: sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
Jul 04 22:42:54 archi sudo[3919]: pam_unix(sudo:auth): auth could not identify password for [user]
i dont have recieved lecture from system admin
you are the system admin
Is that binding to port 80 or something?
100
use a higher port
did you change the config to allow users to bind lower ports?
how
users can bind to ports 1024-65535
only root can bind to 1-1023
and technically 49152-65523 is or dynamic port assignment.
8080 is a common port to use
oh
uh
it fix
thank u
arch btw
I see, thank you
I think I'm going to use Redhat as my main OS, and use windows for a little gaming on a vm
I tried ubuntu for a little bit (a few projects) and I've been really liking it
Isn't redhat mostly for enterprise and servers?
mint is just like ubuntu but better. if you want somth similar
Maybe? I’ve heard it can be good for desktop
I’ll check it out
🙏
nah but you can easily install it with the package manager afaik
apt install blender
Oh alright, it said on their website the apps it contains
noice
Defunct processes should (iirc) eventually time out.
I've not had much luck in getting them cleaned up beyond waiting or rebooting, unfortunately. However, if they're defunct, they won't be using up processor time
If they're owned by you, you may be able to just log out from all seats and get them cleaned up that way (I believe…I could be wrong!)
i am unable to use GPUs
it hangs on doing python ... or nvidia-smi etc
I know about synchronize-panes, but is there also a way to synchronize tmux sessions? Currently I'm using a weird setup with nested sessions :/
I wouldn't think that's true... If you don't have a subscription, you won't get driver updates, security patches, etc...
you can't even submit bug reports without a subscription, AFAIK
Yeah, I’ve seen that with a subscription it’s a really nice OS, but I’m thinking Mint looks good
that's definitely way more targeted at personal use than Redhat Enterprise Linux is.
RH is in it for the money
well, yeah - selling support is literally their business model
But I believe at enterprises, they have a large Linux server, and everyone just SSH’s into it
I have an uncle who’s an IT Director for a hedge fund and he told me this is how they operate
that's one possibility, yeah. Nowadays it's a bit more common for developers to have their own dedicated VMs they can ssh into (still shared hardware under the hood, but they have the illusion of having a private machine)
Mint looks good, 3 weeks until I build the pc 👍
This is what we do at my company
Although yeah we are looking to migrate to individual VMs at some point
one thing. get an amd card if you can. nvidia's linux drivers can be problematic
In what sense?
Part List - Intel Core i5-12600K, Radeon RX 6600, Deepcool CC560 ATX Mid Tower
Im a student and am learning programming.
I wonder would u install an Ubuntu dual boot system for getting used to linux/learning linux commands?
Yeah it's a good skill to have but may not be a priority for you at your current stage. Instead of dual boot, I'd recommend using a VM, or WSL if you're on Windows
thank you yeah I think so
especially others told me I can run VSCode with WSL
Wonderful idea to go dual boot right away.
And switching to Linux as primary OS 😊
That is how I started to be more and more familiar with it every month for last years
didnt u feel any inconvenience?
as I cant find many softwares on ubuntu
The only inconvenience I feel after some time... I fell in love so hard with how developer friendly environment in it, that I can't force myself opening windows back more than for very tiny amount of time
It has its own software available, that is not available for Windows. Just a matter of getting to know stuff
I fell in love so hard with how developer friendly environment in it
I havent known about this yet
maybe very interesting to discover
In fact, Linux flares best if u a doing stuff related to web development and cloud server infrastructure.
It has programs that are not available to windows or work very very very slowly in limited fashion at Windows
At linux they work natively with lighting speed and full functionality
thank you!
do you have plans to uninstall windows someday?
I dont like dual boot personally tbh
I keep windows at dual boot as secondary OS for gaming only, and for that super legacy project in C++ visual studio that I did not bother to migrate to make Linux friendly
I see, thanks
It is nightmare how badly 😔 this legacy project setup. Not automatable at current state to build and unit test.
All my projects at Linux usually do it all on their own in CI tools, since they all run Linux too
it's mainly the interface which is called GRUB2 I think
I had problems with that
I just installed to different SSD drives OSes
Windows at one SSD without awareness Linux exists (plugged out Linux drive during installation)
Linux at another, with grub and discovered both oses
Linux drive is main to boot
Makes simple to reinstall stuff to me
In case I delete windows, repairing grub is easy to remove no longer present windows
Doing same in windows would be unreliably hard to me ^_^
Yeah, dual boot is hell for so many reasons and getting Windows to behave with GRUB2 is one of them. I have a dedicated Linux box and I use XRDP to connect to it from my various Windows devices. You quickly forget you're on Windows with no need to worry about certain hassles of Linux (like the wifi drivers that always seem to break). If you ever do need Windows, just close RDP and no need to reboot.
I also use WSL on my company laptop and it's pretty great too
I agree with it
Im too newbie to fix any grub problems
another reason is most laptop I bought only has one SSD I think
sorry i forgot to reply.
i dont use nvidia so idk much but theres lotsa arguments about it online. for example see the comments under this:
https://www.reddit.com/r/linuxhardware/comments/p63ka0/how_bad_is_nvidia_gpu_support_on_linux/
Nvidia drivers sometimes get "blips" in their update cycle. It doesn't seem to have happened much recently, but it has in the past. Usually, though, it's just a matter of waiting a day for someone to fix the repository
You can, but you will really used to it if you use as a primary OS
any tmux user in the house?
is there a way to move only the cursor to the top of the page without moving the page content itself in copy mode? (this is H in vim in case it's not clear)
the closest i can find is ctrl+b in copy mode (i have vi mode on if that matters at all) but that changes the content of the page which is disorienting to me
I've never tried it, but in the docs it looks like M-R is what you are looking for.
The corresponding command is called top-line, you might want to bind that to something more reachable. At least for me the whole meta key stuff never works consistently.
interesting, looks like it's an issue with my config then.
Command vi emacs
top-line H M-R
implies H should have worked for me
thanks!
Oh, that's why it didn't work for me :D
You could do that
When i started with Linux i Just overwrote the Disk with Windows
Entirely
@ivory moat lets talk here
sure
Have you tried ubuntu previously?
I'm trying to look for a comparative experience to decide
my first distro was ubuntu with kde, kubuntu
then switched to arch and now i use opensuse
why would you even want proprietary software
straight downgrade
why?
i don't want to risk breaking my installation just by not doing pacman -Syu every day
and i dont really like the AUR, too much malware
hi o/
i've made a package manager in python
https://git.iohio.xyz/FPKGProject/fpkg (i know it looks ugly)
currently, i'm working on 0.1.0 fractal
might be needed at times
yo uh
getting this issue
any way to downgrade the driver so it supports chromium v113?
running raspbian on Raspberry pi 4b with box86 emulation for linux64-based packages
which in my instance is chromium webdriver
Doing this in python btw*
yeah there is
@kindred tartan just download the correctly driver
In your code or application just specify this executable. Alternatively export it to PATH 🙂
Oh cool
sweet
oh uh
Raspbian
apparently it had some form of x86 emulation
but it didn't so i had to install box86
worked like a charm
I needed it for some python scripts i had
@upper notch
I see
Why is pip not installing anything... im using arch btw
could you elaborate?
are you getting any errors?
Im really sorry for not giving the error message to begin with
$ python3 -m pip install -U discord
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try 'pacman -S
python-xyz', where xyz is the package you are trying to
install.
If you wish to install a non-Arch-packaged Python package,
create a virtual environment using 'python -m venv path/to/venv'.
Then use path/to/venv/bin/python and path/to/venv/bin/pip.
If you wish to install a non-Arch packaged Python application,
it may be easiest to use 'pipx install xyz', which will manage a
virtual environment for you. Make sure you have python-pipx
installed via pacman.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
as mentioned in the error output, you should use a virtual environment
What if i want something for system config
do you have an example?
Like for a window manager named Qtile
It need some optional dependencies
I dont remember the specifics
you would install qtile using pacman
^
recent versions of pip include this check because installing packages directly into the system environment can sometimes break your system
because a lot of Linux distros make use of Python for their core functionality
Ic
Thanks for the explanation
anyone here use docker-compose on linux and have experience with setting up a MYSQL DB through it?
Mine keeps wiping the DB and creating a new file structure once I use docker-compose down
mysql:
container_name: **
environment:
- MYSQL_ROOT_PASSWORD=**
- MYSQL_DATABASE=**
- MYSQL_USER=**
- MYSQL_PASSWORD=**
command:
--character-set-server=utf8
volumes:
- my_volume:/var/lib/mysql # path in the container where MySQL stores its data
ports:
- 3306:3306
image: "docker.io/mysql:latest"
restart: always
networks:
- mynetwork
volumes:
my_volume:
networks:
mynetwork:
Example structure of my file
try
volumes:
- - my_volume:/var/lib/mysql # path in the container where MySQL stores its data
+ - ./my_volume:/var/lib/mysql # path in the container where MySQL stores its data
...
-volumes:
- my_volume:
will give it a try, thanks
just to check, are you using docker compose down --volumes?
just docker compose down is that bad?
no, just checking, because with --volumes the volumes get deleted as well.
I'm just a bit worried about the stability of things, i'm importing a lot of backdated API data etc now and don't want my data team to randomly message me saying "where did all the data go" one day 😅
I've been thinking about using AWS or Google Cloud Platform to host a DB and to just update it remotely instead
definitely open to any recommendations
that's very good and most recommended option btw (for real prod)
using stuff like AWS RDS MySQL (or usually better postgresql) for example
it allows to go fully immutable regrading deployments
deploying straight containers into AWS elastic beanstalk / or AWS ECS or AWS EKS and etc
or just wiping servers without care and deploying from zero each time (some people deploy as immutable built AMI images)
allows managed RDS db, easy to update in terms of engine and any params
easy to backup
easy to replicate
everything easy
yeah, except your bill.
or, you know, the fact that cloud providers (azure at least) actively recommend you add retries to every single one of your queries, because "due to the cloud, sometimes requests fail". super easy
just add a retry to each of your queries.
I work for a big e-commerce agency so the bill is fine
As long as I can justify it
I don’t like the sound of retries though
Amazon is a pain in the ass when it comes to large amounts of data as it is
I suppose I could store it in my DB on the server I’m renting, then retry to there
Then have a daily push to AWS
the retry pain bit me badly in my previous place. I ended up quitting
The problem is that devs don't expect their world of databases and caches to suddenly vaporize themselves
I understand it all too well
I woke up one day right before a meeting with my commercial director and data team to find my database just vanished
That’s what I want to avoid moving forward
I want to be able to change everything, constantly
But for the DB to remain there
Like a roman toilet
🤔
Every program that does cloud stuff should do retries.
unless you don't want it to actually be reliable.
🤣
Honestly I haven’t been doing this, and I need to
Even when it comes to calls with one variable, I just trust that it does every one of them correctly
Need to find a better way to checking that everything is done and repeating x amount of times until everything is done
anyone know why I would be getting the following when using docker, i'm trying to not use root and create a user with specific perms:
flask-celery-worker-1 | PermissionError: [Errno 13] Permission denied: '/usr/src/app/project/logs/celery.log'
the command in docker-compose file:
celery --app project.server.tasks.celery worker --uid=celeryworker --loglevel=info --logfile=project/logs/celery.log
my DockerFile:
WORKDIR /usr/src/app
RUN adduser --disabled-password --gecos '' celeryworker
RUN mkdir -p /project/logs/
RUN chown celeryworker:celeryworker /project/logs/
/project/logs/ and project/logs/ are different directories
damn.. I need more sleep or coffee 😅
thank you
0 errors and im no longer using root ⭐
i greatly dislike that docker volumes don't allow you to mount relative to WORKDIR
it's one of the only places where you must use absolue paths
-v $(pwd)/relative_folder:/inside_folder
i mean on the right hand side, you can't specify that relative to the working directory inside the container
the left hand side needing to be an absolute path is a separate annoyance
If I am unsure regarding inner workdir, I just overwrite workdir too
-v $(pwd)/relative_folder:/inside_folder -w /inside_folder
but that's even worse!
How do I get the gid (group id) of a group given it's name? For example, on a university computer I have three groups 'student', 'faculty', 'staff' and want the gid for each of them. One option is to import grp and use grp.getgrname('staff').gr_gid, but the getgrname call also tries to populate the gr_mem field of the struct and if i use it with 'student', it tries to pull the name of all students which takes quite a long time
oops! didn't read closely enough
damn, looks like there's no portable way. I'd just parse the damned file by hand 😐
def get_gid(name: str) -> str:
with open("/etc/group") as inf:
for line in inf:
fields = line.split(":", maxsplit=3)
if fields[0] != name:
continue
if len(fields) >= 3:
return fields[2]
get_gid("certusers")
``` wfm
if your group database is remote, like on a Windows server or something, this won't work 😕
hmm. thanks, then! looks like i'll have to stick with the slow solution
I want install python on Windos and Linux with Commands
I don't know what "with Commands" means, but on Linux: use your system's package manager (dnf, apt, whatever); on Windows, download and run https://www.python.org/downloads/release/python-3114/
I think MSI packages can be automated on Windows
Because I want to write malware and I don't know how to install python on my victim system for my malware!!!
...
!rule 5 You won't receive help for that here.
5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.
It ends badly.
Discord hackers are the most powerful beings to exist, even greater than mods. Full power, complete control, nothing gets in their way.
Twitter ➤ https://twitter.com/beluga1000
Join My Discord ➤ https://discord.gg/CETznntGeQ
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
#Discord
this just for fun
and how can we prove that that's the case
script kiddie
Ever heard of a compiler
U sound middle school ngl
as i mentioned a week to two ago, fpkg is my project and it's developed into quite something
(it does somewhat break pep8, with the line limits and stuff)
but the code in of itself is pretty much functional
!rule 6
what files does the scanner generate exactly?(wayland)
Oh, sorry
What scannee
arry poeh
What (graphical) text editors do you use on linux? I like notepad++ on Windows.
Im currently using notepadqq on Ubuntu
VS Code
A Community-led Hyper-Hackable Text Editor
thank you
oh I think I mean a pure text editor
I use VS Code for codes and syntax highlight
Kate. Really good one.
Simple, yet with syntax highlight for all langs
Default in KDE plasma GUI (like Kubuntu)
Not an ide at all
thank you!
This is a dumb question, but does linux/*nix actually stop you from removing a file which is being used by another program 
why should it?
no.
everything is solved by user permission levels
database for example often created by user postgres
so only postgres user or root can change it
fuckkkkkkkkkkkkkkkkkkk
Ngl was really hoping it didn't do that.
why should it?
no.
Something something, no one likes a sigbus
It won't cause an error. If process A opens a file, and afterwards process B removes the file, process A can continue using the file handle, reading from and writing to the file. The inode still exists, just no link to it. Only when the file is closed by A is it really lost.
(And before it is closed you can also undelete the file by finding it in /proc/pid_of_process_a/fd)
(On macOS there's no /proc, but I believe the same can be achieved through other means)
In a sense, unix files work a lot like Python's names. rm a_file does something similar to del a_variable — the GC will only delete the variable if there's no references left, and same on the file system (with hard links and file descriptors both being counted as references)
shouldnt it be preinstalled sometimes? (sorry for screenshot and breaking conversation)
What OS are you on? If it's something debian-y, then you'd need to install python-tk
solydx. yep, debian-based
(didnt even changed home menu logo xD)
why do you prefer it over debian?
network problems 🙂
maybe winget for windows?
hi opensuse
i might try leap as sles might be good for my software
Nice
NICE
hi
ok to ask about access rights here of linux or must i create a help channel. its more about development of a linux-like FS rather than the actual OS
Sure, you can ask here.
program without icon: https://paste.pythondiscord.com/WOFQ
python, tkinter
I am trying to make a simple App with tkinter and I am having a problem with looping, I have two buttons in my simple app.. and I want it to work when another loop is working in a background...
when I press "start" Button, It runs a function "main_prog" with loop, so until the the loop is not complete the window says "not responding" and I can see it printing in the terminal so it's working in background... and this is a problem because I want it to respond and when I press "Stop"
I want it to take that response and stop...
for this to happen I also tried using "threading" module but it felt really slow and unresponsive most of the time it was not responding. also it was starting the function before I wanted it to... so I think threading is not a viable option..
Do you have any idea that I might be able to fix it?
thank you
This feels like you'll get a much better response as a help thread (see #❓|how-to-get-help ) #unix tends to be a lot slower, and your question is not unix-related, so people are going to be less inclined to respond.
how can I do mouse interactions on Wayland similar to Xlib?
realized I probably needed to take this question here.
dumb question because I can't find a good answer. Is it possible to have anaconda installed just in a venv? I've checked the PKG-INFO and it states that I can't install with just pip, but not sure how to keep it just in the venv, since I'd have to use yay to install it from the aur?
trying to get jupyter notebooks to work with vs code having issues with kernel because I need anaconda (to my understanding anyway)
one of my drives just stopped mounting in linux
$MFTMirr does not match $MFT (record 3).
Failed to mount '/dev/nvme1n1p2': Input/output error
NTFS is inconsistent. Run chkdsk /f on Windows then reboot it TWICE!
The usage of the /f parameter is very IMPORTANT! No modification was
made to NTFS by this software.
Failed to open '/dev/nvme1n1p2'.
$MFTMirr does not match $MFT (record 3).
Failed to mount '/dev/nvme1n1p2': Input/output error
NTFS is inconsistent. Run chkdsk /f on Windows then reboot it TWICE!
The usage of the /f parameter is very IMPORTANT! No modification was
made to NTFS by this software.
Unable to read the contents of this file system!
Because of this some operations may be unavailable.
The cause might be a missing software package.
The following list of software packages is required for ntfs file system support: ntfs-3g / ntfsprogs.
or rather, one partition, the partition after that mounts just fine, has some small error about the name but i guess thats related to this
do i need to install windows to fix this or what?
really hope its not dying or anything, quite new ssd, but i think its mounted under my gpu...
ah ntfsfix seemed to have solved it
time to migrate to a different filesystem i guess
I certainly wouldn't use NTFS unless I was sharing the partition with Windows
the Linux driver code is almost certainly incomplete and buggy
Easy steps to create your first virtualenv inside your notebook
how to check which window manager i am running (both wayland and X)? should i check for all processes to check for the window manager?
in python
check for the WAYLAND_DISPLAY environment variable
if it exists you are on Wayland, if not fall back to checking if it's X or a tty
I wanna Know the WM im using
Not either wayland or X or tty
I wanna Know which WM i am using on both wayland and X
right
I think you can check who's using the display with lsof but if it requires root I think you just need to basically list all processes and have a hardcoded list of the options
Alright
And then Check to which Display it belongs to to Check for the current display
what distro youre on?
debian-based
sudo apt install tktinter should be sufficent
neofetch detects it somehow, and it seems to use xprop command:
https://github.com/dylanaraps/neofetch/blob/master/neofetch#L1957-L1960
https://askubuntu.com/questions/72549/how-to-determine-which-window-manager-and-desktop-environment-is-running
olkay thanks
try asking again, I didn't understand that
Google's service, offered free of charge, instantly translates words, phrases, and web pages between English and over 100 other languages.
Modern UNIX OS does not exist. Someone says MacOS is true UNIX. Okay fine, but in this case it's obvious it is not only terminal
So in modern world UNIX is just a specification / standard. However, we have lots of unix-like OS'es, and they definitely include not only terminal
it is common for Server linuxes to run only terminal though. no point to have gui there
it is always an option to install missing GUI if desired though and connect over RDP
there is just no point in it
it is enough doing actionvs over ssh
or even if desired u could connect IDE over ssh/sftp and etc
there is even Linux GUI with RDP offered to be run as container somewhere 😅
that makes pressence of GUI temporal at server if necessary
but there is no point in it
the most used option is usually just SSH tunneling through server, in order to access local/private network resources via your dev machine
(Sometimes people set VPN as an option too)
that makes forwarded resources accability to local dev machine
there are always an option to use programmatic tools to configure server, like Docker/Ansible and etc
people are too used to linux terminal of doing things over console, and not really needing GUI at servers. which would be just consuming extra resources for nothing
That's a lot of words to answer a questioo that has yet to be clarified…
yeeeeee
To summarize, Unix is not an OS, and it doesn't only carry out only a terminal either.
Eh, this isn't really true
AIX, Solaris, HP-UX, they are all still in existence and updated, and are proper Unix Operating Systems rather than just "Unix-like"
but they are primarily used in large (and usually old!) enterprises, and not very much in smaller business, clouds, consumer environments, etc.
Solaris is a proprietary Unix operating system
...
Latest Release: 11.4 SRU57[1] / May 25, 2023; 2 months ago
https://en.wikipedia.org/wiki/Oracle_Solaris
AIX is based on UNIX System V with 4.3BSD-compatible extensions. It is certified to the UNIX 03 and UNIX V7 marks of the Single UNIX Specification, beginning with AIX versions 5.3 and 7.2 TL5 respectively
...
Latest release: 7.3 TL1 / December 2, 2022; 7 months ago
https://en.wikipedia.org/wiki/IBM_AIX
HP-UX (from "Hewlett Packard Unix") is Hewlett Packard Enterprise's proprietary implementation of the Unix operating system, based on Unix System V
...
Latest release: HP-UX 11i v3 2023[1] / May 2023; 2 months ago
https://en.wikipedia.org/wiki/HP-UX
anyone here familiar with grub the bootloader? guy in ot0 needs some help, maybe grub can help
i have problems with installing requires for some script.
my OS is solydx 10 (debian). python yet 3.7
here error log:
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DFFI_BUILDING=1 -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.7m -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.7/c/_cffi_backend.o
c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-kw4hzj5w/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-25eidkg7/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-71uy8s1h --compile" failed with error code 1 in /tmp/pip-install-kw4hzj5w/cffi/
----------------------------------------
Command "/usr/bin/python3 -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-71uy8s1h --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools>=61.0.0 wheel "cffi>=1.12; platform_python_implementation != 'PyPy'" setuptools-rust>=0.11.4" failed with error code 1 in None
command: pip3 install impacket==0.9.23
Install libffi-dev
k
Might be safest to install everything listed at https://github.com/pyenv/pyenv/wiki#suggested-build-environment under your particular distro
What's a lightweight linux distro with a graphical environment which runs python well (&tkinter)?
If you want extremely light, maybe Alpine (it does include tkinter in it's main repo apparently). If you just mean something that doesn't need 8gb of ram to be useable, I'd try any normal distro with a lighter window manager (Lubuntu or Xububtu for example)
Artix,Arch, Alpine, Parrot, Arco, many others. Just use Xfce, Lxde or lxqt desktops
yeah the distro usually matters less than choosing the right desktop
debian with xfce is an old staple
lately i've been enjoying endeavour, it's very nicely set up. i believe xfce is one of its default options
I'm trying to output a string like this echo "string" > file.txt but when I cat the string it's not the same as what I put inbetween the quotes. Why is this?
can you give an example that actually shows the problem?
This was the string "$y$j9T$dDRO50LNqijRmgC4eO4TA/$MbRSqDrgELP1JjxbW/BslB4Qtumg.nipkMsGg3ffhM4"
without quoting, those $ will get processed as parameter expansion by the shell. so $y will expand to whatever y is set to, or the empty string if unset. and so on
echo '$y$j9T$dDRO50LNqijRmgC4eO4TA/$MbRSqDrgELP1JjxbW/BslB4Qtumg.nipkMsGg3ffhM4' > file.txt
cat file.txt
i also hope you didn't just share an actual API key or something
nah just a hash of the word test lmao
wdym by without quoting?
putting quotes around the string
so using double quotes doesn't "count" as quoting?
it counts, but parameter expansion still occurs inside double quotes
double quotes mostly protect against whitespace being interpreted as an argument separator
single quotes stops all expansion, including parameter expansion and escape sequences
aha! thank you so much!
it is probably a salted hash
mmm corned beef hash
Anyone here understand swap partitions on Linux? I was wondering if I even needed it and wanted to free up the space and use for other partitions.
you probably don't need it
you only need it if there's a real risk that you'll run out of RAM, and if you're willing to accept a 1000x slowdown to prevent that
(ok, ok, maybe it's only 100x)
I have 32 GB ram on this machine. I looked at my system and found that it is using something called a swapfile. I am confused. Here are the outputs:
`:~$ swapon
NAME TYPE SIZE USED PRIO
/swapfile file 2G 0B -2
$ sudo swapon -show
Filename Type Size Used Priority
/swapfile file 2097148 0 -2`
you have a swapfile, but it's not being used.
unless you're low on disk space, don't worry about it.
parts are arriving in 3 days, still debating on mint or ubuntu
my only issue with ubuntu is the desktop and i can change that
idk about mint though
I'm only worried about the part where 20 GB of my disk size has been allocated to swap partition during first install of the OS. If the understanding here is that I am not even using that partition, I'd love to allocate that 20GB to the linux partition.
looks like it's 2GB, not 20GB
I mean, sure, get rid of it if you want.
I think you need to run sudo swapoff /swapfile or something, then sudo rm /swapfile
now, "using it for other partitions" might be tricky.
You can use Ubuntu with pretty much any desktop environment you want. There are official spin offs like Kubuntu, or you can install the server version which comes with no desktop and add whatever you want. Then there are unofficial spinoffs like Regolith (which is Ubuntu with i3 window manager and no real desktop).
If you're a Windows user and just want something intuitive and easy by default Linux Mint is a good bet
it's really useful if you want to hibernate, that's often where your memory state gets dumped for hibernation. in general it's a place where the OS can dump stuff that it doesn't want to hold in memory but doesn't want to completely free either. that's possibly because you're out of memory, but also can be for things like filesystem caching
you will need to remove the corresponding entry from fstab. otherwise your system will go looking for the swap file on next boot and fail to find it. you will likely end up in the grub console in that case.
fedora kde is a great experience if you can get past the installer, which is very much not a great experience
I’ve never used windows, only macOS
endeavour kde has also been excellent but i don't recommend rolling release to someone who isn't prepared to deal with rolling release
I have some experience with ubuntu
is drag an drop worse on linux in general? or is it just kde/plasma?
i was an avid drag and dropper on windows, but theres a lot more friction on linux
could just be that im not used to it ofc
I personally gave up on Linux guis ages ago.
ijust tried to drop a file into vscode, and every time i mouse over vscode in the taskbar it darted away to the other side of the task bar
actually all non-terminal items on the taskbar does that, how strange
gotta investigate if its a stupid feature or a bug to report
I'm not a KDE/Plasma user so I'll blame that ...
To me half the point of using Linux is to need the mouse as little as possible, but I've not noticed any major problems with drag and drop when I do it
i probably just use it 100 times more than the average person
dont really use my left click normally when browsing, most links i open i just drag and drop into the tab bar
2GB is the swapfile
There is 20 GB I allocated to swap partition during install. I was referring to that.
oh, well those are entirely separate
they solve the same problem, but they're otherwise unrelated
sure
same answer: if you're not worried about running out of RAM, then sure, use it for something else
I don't use hybernation. Also, please check the screenshot I posted. I am not talking about the 2GB swapfile I found on the system but the 20 GB swap partition I allocated during original instal.
yes, I understand that
the swap file and the swap partition solve the same problem. If you don't have that particular problem (running out of RAM) then you don't need either.
Since it looks like the 20 GB partition isn't even being used, I will probably have to use GParted to allocate this 20 GB to my linux partition. I thought I could do it from inside the OS but it may require a flash drive.
it might; I haven't repartitioned in so many years that I assume the technology is now different
If you're moving the system partition, yes, you'll need a live system to do that from.
Installs will often automatically give you a swap partition, unless you actively ask them not to
Although I'm surprised that you got both a swap partition and a swapfile from an installer (I'm assuming that's where they both came from)
I'm also a tad surprised it bothered with an extended partition for the ext4 (system?) partition. You only have three partitions. You don't need one in an extended partition.
(Not that I know of any downsides to that, beyond having the extra partition entry)
during the install, it let me allocate some memory for swap. I gave it 20 GB. I have no idea why it ignored that and just made a 2gb swapfile
drive
IDK what that extended partition even is. I just know that it is there. lol
An extended partition allowed you to have more than four partitions on a drive (I don't think that's a limitation now, either)
Well! I'll have to find a way to safely backup the linux partition first and then try to GParted resizing thing.
Do you have 100 Gigs of storage somewhere else?
The easiest is to use dd to create a raw image of the partition
yes
But wouldn't that be a problem for resizing?
is it a hdd?
ssd
resizing isnt an issue on ssds is it?
no idea
im not 100%
If it's running the current system? I think it still is
but theres just no way it would take forever like an hdd
even if data had to be moved, its so much faster
in my head, for an SSD it should only be updating some list of pointers or something
it probably doesnt have to be moved either
yeah i mean its shuffling data around for wear levelling anyways
The bit I didn't understand is if my dd backup is image of a 100gb partition, wouldn't restoring from it force the new partition to be 100?
If you found you needed the backup, it's either that your partition is borked, in which case you just write the data to a new 100G partition and start over. Or it's that you need some of the data, in which case you mount the image and grab what you need
oh sorry! Yeah! My bad. For some reason I was thinking I'd make a 120 GB partition after dd and try to slap on this 100 gb image on to that.
I hope resizing the linux partition isn't going to mess up the data partition
The NTFS partition? No, it shouldn't
If it does, something more major is going wrong!
From all the gparted tutorials I've seen, it doesn't look like people are usually afraid of resizing.
I'm always tentative - I've had things go wrong enough times in the past that I am just extra cautious, however much things have improved over the years ;)
same here. Dealt with horrible nightmares. My system is Ubuntu 18.04. Not sure if it has the improvements your disasters should have had.
I've definitely observed people having disaster situations after messing with the partitons to where I would say no matter how much more feasible it is than it use to be, it's not something you should do without backing up unless you are prepared to lose the partition.
I think it often has to do with, they downloaded some piece of junk free trial crapware to do it, or...they just didn't understand what they were doing enough and did the wrong thing
But it happens
'"The servers in today's data center are like puppies -- they've got names and when they get sick, everything grinds to a halt while you nurse them back to health," Joshua McKenty, co-founder of Piston Cloud, is quoted as saying in a recent company press release. "Piston Enterprise OpenStack is a system for managing your servers like cattle -- you number them, and when they get sick and you have to shoot them in the head, the herd can keep moving. It takes a family of three to care for a single puppy, but a few cowboys can drive tens of thousands of cows over great distances, all while drinking whiskey."
sounds like y'all treating your ubuntu box like a pet
or else you're not drinking enough whiskey, or saying "yee-haw" loudly enough 🙂
Yeah. I treat my data with tenderness because I never get around to backing it up until it's possibly too late.
my nginx containre uses FROM nginx:latest
my python container uses FROM python:3.11.3-alpine
if I shell into the nginx, I will not have features like tab completion or ANSI colored output. However if I shll into the python one, I will.
Specifically for the tab completion; what is missing that makes it not available on the nginx container?
Assuming it's using bash as its shell, then https://stackoverflow.com/a/5574402 shows how that works - but it may just be that you need the (equivalent of the) bash-completions package (which is mentioned towards the bottom of the post). [Note: I don't see a bash-completions or similar in the Arch repositories, so ymmv.]
My /etc/bash.bashrc references /usr/share/bash-completion/bash-completion, but while I have /usr/share/bash-completion/ with content underneath it, I don't appear to have /usr/share/bash-completion/bash-completion itself, which seems a bit odd.
(I'm running xonsh, though, so things may not all be tied up for bash)
ah its probably as simple as just installing that in the Dockerfile.
nah but someone here might #data-science-and-ml
i looked it up earlier
but i dont know much about it
didnt seem that interesting
i cant open links from discord, this happened before too, but the solution last time doesnt seem to work now
last time i had to uninstall wslu im pretty sure
googling now says something about setting some dbus variable to autolaunch
anyone had the issue? how do i fix it?
When I do rsync -avP, I get a copy of the files I rsynced in a directory that's named as the ssh user@ip. Is there a way for me to modify the files in that file so it automatically links to the file in the VM I sshed into?, e.g changes I make to the file in my local directory is reflected to those files in the VM?
no
that's not what rsync does
you might be able to get something like that with sshfs though
alternative, Clear Linux is pretty neat! I love Alpine, but it's missing a lot of key things for use in things other than containers IMO
is unix especially great for programming?
Nope. Linux is just a tool, same as Windows
cool
It is a bit more oriented towards having tooling for programming easily available
You are expected to want to tinker with Linux, less so with Windows
I'll just come out and say "yes".
To a first approximation, the only programming that works well on WIndows is: writing Windows apps.
what about them?
they can work outside windows
sure. I don't see how that relates to your original question, though.
so if you use unix, is it more useful?
depends what for
ok then thanks
Never stepping outside of windows is similar to never leaving your home country. You can live your whole life that way... but youll be missing perspective of the world.
it's not LTS lmao
because of LTS
you are running that off the garbage can ?
I have fedora but have not been able to get Steam working on it. Do you have to use Ubuntu for gaming ?
ive tried converting the deb package to redhat package but just its not easy
Have you tried flatpak?
And no, you don't need ubuntu
yes
i will have to look that up, thanks !
Just messing looks great
lmao
pc specs are going to be good for programming and a little gaming
gpu hasnt come yet but it still performs well with everything i threw at it
regex moment
Hit some weirdness. According to https://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits, the filename length limit on ext4 is 255 chars. Yet I'm able to create (in my folder, haven't tested elsewhere) files with ASCII filename of lengths only up to 143. Any idea what that may be caused by?
is this something weird like wsl?
I imagine the file system's limit is only one of many; the kernel has a say in the matter, too
Nope, just an ordinary linux mint system.
ah-ha, got it maybe. If I write to /tmp/filename, I can get all 255 chars of length.
So it's only for my home directory. And it's encrypted, IIRC my decisions from like a year ago.
so maybe it's an encryptfs weirdness.
likely
betcha they encrypt the plaintext filename, then tell the kernel to use that encrypted wozzit as the file's name; and the encrypted wozzit probably has some header
My cibuildwheel runs on Alma_Linux but this building process fails. what could be wrong?
[tool.cibuildwheel.linux]
before-all = [
"git clone https://gitlab.freedesktop.org/libinput/libei.git",
"cd libei",
"pip install Jinja2",
"pip install attrs",
"yum install -y pkgconfig systemd-devel libxkbcommon-devel libxml2 doxygen python3-pytest",
"yum install -y meson",
"meson --prefix=/usr builddir/",
"ninja -C builddir/ ",
"ninja -C builddir/ install"
]
ninja: build stopped: subcommand failed.
I only can do 2 things, find a way to install it from the source by using AlmaLinux or go with an image which supports the package.
yeah....
perhaps "ninja -C builddir/ " should have a verb? Disclaimer: I have no idea what any of this stuff is 🙂
I'd spin up an Alma VM and try those commands by hand
What do you mean?
What's wrong with the ninja command?
Btw this is a cibuildwheel.
Well, you've got two invocations of the "ninja" command. The second of them has a "verb" -- "install" -- but the first one doesn't. I was wondering if that first one might be wrong.
there's been going on some discussion about the issue here: (if you are interested)https://discord.com/channels/267624335836053506/1138844639449858130
i think its almost comparable with windows barring games with ( anti gnu/ linux)->( anti cheat)
yeah
it’s nice that amd drivers were engraved in the kernel
ah cool, i hear nvk may be a suitable open source alternative to the nvidia propriatary drivers when the project is more complete
cool
this was first build so it was nice not to have to worry abt drivers
ah
i was interested in a non c++ but performant programming system and was therefor interested in rust, do you prefer one such as go?
why not c++?
because i find it wordy and without already knowing the system, i put more faith in a newer system
as someone who has been learning c++ for two months
it is as bad as everyone says
i did python for 2 years
and c++ was a HUGE transition for me
everyday it is something new that makes my brain mushier
lol mood
Anyone knows how can I get this folder-sharing work in a vm(Fedora)?
how do I activate the venv on macos?
I created the virtual environment
now I have to activate it
Should just be django_test/bin/activate, I think. Might want to check whether the activate script in bin needs any suffix…probably not
doesn't Mac :D
might need to do something like source django_test/bin/activate but the path should just be that
I could finished it, thanks
it worked
now I am at this part, but I want to use VSCode
should I've done all these steps on VSCode tho?
No, VSCode will pick up that venv
or if I just open the project it will work just fine?
that's the project I've created, like this?
Yes, if you start a project in that directory, it should find the venv Python. If it doesn't, you just select it from the menu on the bottom-right (or Select Python Interpreter in the…shift-ctr-p menu (whatever that might be on Mac! shift-cmd-p?)
you use linux right?
Yep
some_command > /dev/null 2>&1 & is the standard way to run something in the background without being bothered by stderr and stdout right?
Yep.
thanks!
is there a unix-interpretable character that has no unicode representation?