#unix
1 messages · Page 59 of 1
use a venv, or at least pip install --user
it's just that in windows, breaking python doesn't also break your entire computer
Yeah, I hadn't heard of venv then. In fact, I had never used versioning tools for any language
i actually hate that system-installed packages use the same site-packages location as user-installed packages
i think debian maybe separates the distro-provided packages from user-installed packages?
By the way, how does it make sense that I can import sys in the python interpreter, but not through the scripts?
no, but be more specific
$ python3 a.py where a.py is a script that imports sys will error out ('sys' is not defined), but
python3
>>> import sys
will work just fine
note that python3 and python apparently call the same interpreter, at least the same version (3.10.1)
wait, apparently pandas is also not being imported
pandas is a different story, start with the core stuff
that's very strange indeed
what does python3 -c 'import sys' do?
jesus. I think the issue is with pandas
# Imports
try:
import sys
from pm_func import *
from setup_db import setupDatabase
except Exception as e:
sys.exit(f'Failed to import libraries. ({e})')
So I'm testing with a script that begins with this... which gives me an error (yeah, I know the exception isn't meant to be used that way, I'm so sorry) about sys not being defined
but if I remove the try block, it does import sys, but errors out with setup_db (which is another script, that imports read_excel from pandas)
that's also weird. it certainly can't hurt to reinstall
yeah, because it will dump the files into exactly the same place as pip
again i think debian does a better job here, they patch python to put system packages in different places from where pip puts them
Okay, now I'm feeling terribly stupid -_-
In any case, thanks a lot for the attention and help, @formal schooner !
mixing the distro package manager with pip is always an exciting experience
hello
i need help with linux bash scripting
here is the code:
at now
at> echo "hello" | mail jon
at> ^D
can someone explain me what mail jon is?
Sending "hello" to email address "jon".
| Symbol makes data flow redirected from first to second command
More understandable looking would be next code
echo "some text here to send it...." | mail -s "My_subject_is_here" send_to_some@email.com
But how can an email be only "jon"?
In a learning book. It's explaining how at command works. So i got this code under "this at command will send an e-mail", thats all
I believe that means it's sent to a local user mailbox
can be, that's the only thing that makes sense in this context
2>&1 < /dev/null redirects stderr to stdout and then discarded by dev/null ??
little lost here
no, < /dev/null means you connect stdin to /dev/null
if you wanted to discard both stderr and stdout you would write >/dev/null 2>&1
that means:
- connect stdout to
/dev/null - connect stderr to "wherever stdin is currently pointing"
redirections are read from right to left, and X>&Y is a redirection to "wherever Y is currently pointing", it is not a permanent connection between X and Y
you could of course write >/dev/null 2>/dev/null or perhaps 1>/dev/null 2>/dev/null if you really want to be explicit
quiz: what does this do? >/dev/null 2>&1 >./out
Out and err get written to a File?
stderr goes to /dev/null and stdout goes to out
cat >./tmp.sh <<EOD
echo 'good'
>&2 echo 'bad'
EOD
sh tmp.sh >./out1 2>&1 >./out2
echo '-- out1 --'
cat out1
echo '-- out2 --'
cat out2
So &1 is evaluated when 2>&1 is evaluated rather than when the entire line is finished?
precisely
perhaps "expanded" would be a bit better
but "followed" i think is better still
X>&Y treats Y as a "pointer" of sorts, and it redirects X to "wherever Y is currently pointing"
What's dis channel for?
Tooling, setup and configuration related to Python development on unix or unix-like systems such as Linux or MacOS.
Alr
i use arch btw
cool
i cant add an xrandr custom resolution afer installing nvidia driver pls help
This is the best pickup line 🤣
fr
^^^ That dude gets it 😎
I can't launch jupyter notebooks, but only when I'm connecting to my linux (mint) machine via rdp. I try to launch it via terminal "jupyter notebook" (or "jupyter-notebook") and it says that the jupyter command doesn't exist. If I walk over to the linux machine, I can access it through the terminal without issue.
That's an odd one... I use RDP a lot (but not Jupyter) and haven't seen something like this. If you're physically at the machine and you do which jupyter what's the path? Can you run it from that path when connected via RDP?
I was able to fix it by re-installing jupyter. Should have been the 2nd or 3rd thing I did.
I want to build a simple terminal inside panda3d. Is it possible to read/scrape and control a separate curses application (say...vim) using python's stdout/in/err?
Or can anyone namedrop libs that could make something like this happen without reinventing the wheel?
What’s the ultimate goal ?
to take over the world
all my computer does is run panda3d and terminals so I figured I could get rid of the terminals
This might be helpful, http://zed.github.io/GateOne/Developer/terminal.html
Writing a terminal from the ground up is a great learning task, is there value in it ?… not quite sure
I doubt it. Best case scenario is something that already does it and I can pipe to my TextNode.
though the license is very strict :(
of GateOne
I'll take my chances. Thanks :)
Simple VTXXX-compatible linux terminal emulator. Contribute to selectel/pyte development by creating an account on GitHub.
this looks cool too
What's the error
semi colons i reckon
hello
num1 = input("Enter Num1")
num2 = input("Enter Num2")
num3 = input("Enter Num3")
that's hard
two if, only one ending fi. add additional fi
for i in range(10):
input(f"Enter num{i}")
```do not repeat yourself
anyone knows how to automatically back up
a windows folder on a Arch-linux computer
via wifi?
ive tried with putty on windows
and ssh in arch
but always it always give me a network error
if there is any other method ill appreciate any info
btw i've also tried with nitroshare, but it will not let me send folders
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
as a putty, there is special pscp program for file transfers between client and server
this is where i got putty
have u tried pscp, which is just under it?
it should be good for file transfers
there should be much better ways to transfer files for backup purposes...
yeah, ive pasted pscp on the windows 'root' folder and accesed it from the command promp
rsync or something like that
rsync is a linux command right?
so u kind of download the folder with it
I am going to make backups with ansible ;b I have quite small file sizes though, that's why I sure it willl handle it easily
im trying to backup a python program, the thing is
that the data base is like 4 gb
so im thinking that this might be the problem
for small files putty os pscp works just fine
but when i try to sync the database it fails
could it be because it is still in work
and when you make copy, it changes in the process / or just busy
how about stopping for a moment when you make a copy of it
at least a local one for speed
i don get it mate 😦
stopping database service
making local copy of data / optionally dumping data
enabling database service back
downloading in whatever wished time the made local copy
u telling me that i should try to sync a copy of my database instead of the original file?
i mean, what is taking 4 gb size?
i thought it is database
uh.
oh btw
i can totally not backup the database\
u know
it is not changing
so the other solution is having a program or proces for backing up certain folder
but ignoring certain directory inside it
u know
but i wasn't able to do this with putty
or pscp
they r 2 simple
😦
too*
ill be hearing any ideas... thank u Darkwind
a windows folder on a Arch-linux computer
what does a windows folder on a arch-linux computer mean?
I assume samba usage perhaps
It makes sharing folders with Windows emulation of folder sharing
U know if he used it, he would be probably having no problems to backup then 🤔
Although that is an option only if he has server in his local network
Remember I mentioned Rsync?
First googled link to 'backup from Linux to Windows" suggests exactly it
https://www.petenetlive.com/KB/Article/0000892
I'm using os.environ.pop() but the variable is still present in /proc/nnn/environ, is that supposed to happen?
thank u so much my friend, i will definitively give it a good look
yeah, actually that might be the problem, the thing is that on putty ive set a timeout long enough, but in the pscp i dont think u can
mutating os.environ doesn't actually modify the os's env
Hey all! Anyone free to help me out briefly with updating a CSV file using bash scripts from a python programs output?
what is it exactly that you are trying to do betwixt bash and python?
Why does ubuntu screen use this command will not continue run after detach?
echo templates/index.html | sudo entr service apache2 restart
The docs say (https://docs.python.org/3/library/os.html#os.environ):
You can delete items in this mapping to unset environment variables. unsetenv() will be called automatically when an item is deleted from os.environ, and when one of the pop() or clear() methods is called.
and?
you "and?"
?? what
Unless you want to qualify your answer it is provably wrong
if your reaction to that proof is "and?" what do you expect me to say?
Is that how you talk to people in real life? They say something and you go "and?" come on man
what i said remains true. i don’t understand what you’re trying to tell me here
clearly you don’t understand the concept of system variables and how changing a python dictionary doesn’t magically perform an io operation and edits the os’s system environment variables. stop being ridiculous.
If you decided that outright, based on nothing, why answer at all? To make yourself seem smart? "os.environ is not actually the OS environ". Good job, you couldn't possibly have made this more terse or less enlightening
I'm fine, I've found https://unix.stackexchange.com/questions/302970/why-doesnt-unsetenv-modify-proc-pid-environ which goes into the details of the layout of the environment variables
I'm just puzzled as to why you would bother reading questions here if you only do it to provide unhelpful cryptic remarks
I get it, I've been a 17 year old on PHP-BB forums and IRC, at the top of the sandbox providing terse comments to make myself look smart. You'll come to regret it too
"and?", come on
1: it’s just common sense.
2: i literally answered your question. if you think this matter is about pride, then you’re mistaken.
3: you’re angry for no reason.
You answered nothing. Compare to the StackOverflow answer
what?
what was your question then? i literally answered it. did you want me to babysit you through the process of grasping that os.environ is just a mutable copy of the actual env?
What you could have said is "changing Python's os.environ calls libc's unsetenv but that doesn't remove it from memory provided by the kernel". Instead you mentioned "OS" and "environment" like it meant something specific
you managed to craft the tersest, most inscrutable answer that is technically right without revealing any information
well done
so u mean i was supposed to babysit you?
just ask a more specific question in the first place
My question was extremely specific, with the specific code I used and the specific result I observed
HOW is it cryptic to infer in plain english that modifying os.environ doesn’t modify the actual env provided to u by the os?
what is "the actual env"? What is "the OS"?
i’m done here, clearly you love wasting time arguing about nothing
os, the Python module? Actual env, os.environ?
libc's idea of it? The kernel's idea of it? /proc's idea of it?
I suspect you didn't know and still don't
1: up to you, whether you want to refer to the process’ env (located in /proc) or to the system wide one (/etc/environment)
Up to me to build my own answer? Thanks
2: operating system, i will refer to modules now with highlighting
my goodness.
i was clarifying what i meant.
implying os.environ is a regular dict
(it's not)
I see, that's what you thought it was @main olive. That is why I provided this link: https://docs.python.org/3/library/os.html#os.environ
It you had read it instead of saying "and?" you would know it is not "just a mutable copy of the actual env"
sometimes the only way to win is to not play at all
Hi Im learning abt sys calls currently and I dont get what actually happens when the cpu needs to execute some kind of system call instruction. They say it sends that sys call to the kernel but what does that actually mean for the cpu?
On modern processors there's an instruction specifically for that
you put the arguments in registers, do syscall <some number> and the CPU will pause your thread and jump to a routine in the kernel that's designated to handle that syscall number
so this interrupt makes it jump to a new memory location (new instruction)?
it also switches out the execution context and the security level
the kernel has more permissions that regular processes (can read everyone's memory and talk to hardware directly) and uses a separate memory space (it doesn't mess with your process' stack etc)
Wdym by execution context?
the virtual memory layout for example
So it switches to the memory space of the kernel?
yes
Yeah u have to do a sys call everytime u want to do some i/o right?
Pretty much. There are things like io_uring trying to do more work with fewer system call, because this context switch takes time
How does it know though which routine to jump to? Like u said the number identifies it but how does it know on what line these instructions can be find in the memory space of the kernel?
Yeah I can imagine
The kernel gives the CPU a table that says where those are
Wdym give the cpu it? Does it save it in its cache or?
there are other "interrupts" in there, telling the CPU what to do if the process crashes or something
Ah ok
yes there's some internal memory in the CPU that stores this
How does the os make sure that its continuously run?
Like in order to schedule new processes and stuff
there's a timer in the CPU, giving back control to the kernel every few microseconds
or hundreds of microseconds rather
Where does the cpu know though that it needs to give control back to the kernel? Like where is written that every so and so ms u need to run the os processes again?
So like a hardware timer? does it update with the cpu clock speed or?
yeah you write to some special CPU register and it will call an interrupt when the time comes
the nitty-gritty is complicated and you can find it in the CPU manuals. You can't really use those registers anyway unless you're writing a kernel yourself
Does the os block u if u try to write onto it or what does happen?
yes
the CPU knows what permission level it is running at. User-space processes can't use those
Ahh ok, how does it know though?
When the kernel switches control to a process, it sets the permission level
it also restores the memory mapping that process was using before, and its registers
So I assume the current permission level also gets saved in some special register?
In the meantime while the program is not getting executed does it save them in the programs memory space?
no the kernel has special space to keep track of that
Ah ok
it keeps track of what files you have opened, what user started the process, its priority, all kinds of things
What do you mean by what files opened? Like the user or the program?
Yeah, when you use a syscall to open /home/dragojak/file.txt, it needs to know if you have the right to open that file. So it has a user ID associated with the process to do that
if you can open it, it's going to give you a number or "file descriptor". For example 3. Then you can do write(3, "hello"), and the OS will know which file that was that is number 3
maybe you don't have permission to write to it, so you opened it in read-only mode, and the kernel is keeping track of that. It would be bad if the information about it was in the process's memory, it could change it to "read-write". Instead the kernel keeps track of it and only gives you a number for it
Is this id the PID and does the kernel have some kind of ranges like these ids can access this and this and starting from this id not anymore? Since when I was looking into my task manager and looked a bit at the PID's of programms they were kind of ranked, so all the os processes had really know numbers starting from 0 or 1 I dont remember
PID is the number of the process
they are just used to identify the process, like if you want to kill one of them
Yeah thats true
in addition the process has a user ID and group ID. It will be in a different column if you use ps or top
Ah ok
Whats the group ID used for?
mostly accessing files
So like ranges?
no, usually a file belongs to a single user and a single group
if you're that user or in that group, yes, otherwise, no
What do you mean by ps or top?
the commands to list processes
so users in this group have access to these files etc.?
yep
so I assume there arent that many groups right?
as many as you want
so OS have a limit of 65535, I think on modern Linux it's way more than that
I have 89 on my laptop
Oh okay, are the os processes also in a group?
usually multiple groups
Shouldnt they all have access to every file (the os processes) ? Or are the groups also used for something different?
Of course everybody shouldn't have access to every file
multiple people can share a machine
No I meant the os processes, shouldnt they all have access to every file?
Not the user mode processes
On UNIX there's a special user ID 0 called "root". This one has access to every file
they are still user-space processes
the kernel itself does whatever. It doesn't need to use system call and it doesn't have user IDs
it usually acts on behalf of a specific process though
Oh okay
Lets say I would create such a group, do I put in a bunch of file descriptors and say this group has access to those and nothing else or...?
Ownership is set on files not file descriptors
it's stored on disk alongside the name of the file, its size, the last time it was accessed, etc
Ahh ok
In the basic permissions, there's only one user and one group that own a given file
there is an extended "ACL" system that allows to give specific permissions to multiple users and groups for each file
really you can read about this: https://en.wikipedia.org/wiki/File-system_permissions#Traditional_Unix_permissions and experiment on any UNIX
Ah ic thanks!
Is that like a basic group? Is the user in that group?
the user associated with a file doesn't have to be in the group associated with the file, no
So how does the user have access to it?
really you should read about this
Yeah thats true thank you really much for the time you took, to explain me all this!
if you're the user, you have the user permissions (for example: read-write). If you're in the group, you have the group permissions (for example: read only). If you're non of these, you have the other permissions (for example: none)
Ah okay
Is there a place I can find embeddable python packages for linux similar to the windows embeddable packages found on https://www.python.org/downloads/release/python-3102/
shouldn't need to, do it through your package manager
usually bleeding edge rolling release distributions get them quicker than staged release distributions (i.e. can't expect to get 3.10 on debian stable until next stable)
while using the package manager generally works, I have a specific need for embeddable packages. Alternatives won't solve for what I'm trying to do 😦 (that I know of)
what are you actually trying to do?
Hi o/
I'm making a game in python and I need help with macOS builds/build scripts for macOS. I'm specifically looking for someone who knows macOS's file structure (where certain things are stored, how they're stored, etc.), python development in a macOS environment (optional but would be nice), and the zsh shell.
If anyone is interested, ping me!
Cool.
OP
I use Arch with KDE
Currently booted in Neon though
I have multiple operating systems lol
Had 5 yesterday, deleted 2.
Cool.
Never tried WMs that much except once in BlackArch Full
Fluxbox
Lmao Arch with BlackArch Mirror is best
But then comes SysToOmDeE haters
Happened with me too but I fixed somehow
BlackArch COMES BROKEN BY DEFAULT
Somehow I fix it lol
Or just trust the repo by default
Without GPG
Cuz we know blackarch is safe
Yeah
Lmao I installed very few things
Wifite, Metasploit, JohnTheRipper, etc.
Lmao I've given up on VMs
XD
Everyone installs it lmao
But installing postgresql in Arch was pain in the ||ass||.
Wha-
I didn't know this BTW
TF
What the
Don't say Impacket
👀
Why do we need BlackArch Repo then-
That doesn't work normally, needs the Jar File Version anyways
I don't install that from repository
tf
Yeah Ik
Yeah
john the ripper GUI never worked in arch for me btw.
I don't think I need even lol
Is GUI Actually needed for these?
XHydra, Jhonny, etc.
Lol then why do they exist even
A guy who would know to operate it would know terminology for sure
No need of GUI
Btw is there any way to make Wifite work on 5 GHz Bands?
Understood that the moment I understood how everything in linux works lol
It's all just a collection of processes executed in shell either automatically or manually.
I didn't even try to know.
Lol
Lemme google it now
wifite --5ghz
Okay why didn't I google that for so many months
I had no interest in cybersecurity after Linux attracted me.
Yeah but postgresql makes it faster I've heard
Literally, documentation?
:)
Btw immediate help
sudo pip3 install comtypes
from comtypes import CLSCTX_ALL
Run this in python
And tell me if you get any error
Doesn't come but somehow metasploit uses it if it's available.
Though I don't know exactly how
🥲
Found that now
doas?
doas needs to be enabled?
How to exploit it?
Yeah but in what ways?
Okay currently in KDE Neon so I'm in sudo group
Any single blog?
A Website kind of thing, not a video
I don't like to watch videos tbh about tech
I learn from sites
Is it patched?
Checking
Cool
Bug was found in 2011
It might've been fixed by now.
no error, the container just doesn't load at all
i've wiped my pc like 4 times in the past 6 hours
but i think i've found a fix
There should still be some kind of error in the docker log
Provide a hermetic installation to my Bazel project. Something that Bazel can download and guarantee users haven't poisoned it by installing dependencies.
appimage maybe?
There's already a solution for windows, it seems. With the existing embeddable package
Linux apps that run anywhere
this could be relevant https://github.com/niess/python-appimage
can anyone tell me how i can put a code in crontab which is going to be executed and printed in my terminal every minute?
pwd == /home/linuxuser/string.sh
|
V
#!bin/bash
echo "hello"
crontab
*/1 * * * * /home/linuxuser/string.sh
this is what i have so far
ps. im running this as root
while you can do this with crontab doing this that way would be unnesecary complex
you should just add your script with while sleep to your bashrc and make it run in background
If you do want to do this with cron instead of how Hodd suggests, for every minute I think it's all plain *, no /1
If the application is not in the crontab, the common way to ensure it is started after the host is rebooted, would be a systemd service, which can be arguably even more complex than the entry in the crontab.
script in bashrc will be executed when bash shell is started so it will survive reboots. crontab entries initsystem services etc would require finding stdout of the shell which is achievable preaty easyly hover it is still harder than simple loop and well it might break something cause it would work with non interactive shell also
would you guys say it’s worth setting up a nice dev environment with vim + tmux etc instead of using a standard IDE/text editor?
I mean I guess it comes down to preference really, but I’m curious
I don't use tmux unless I need a persistent session like over ssh
If you want to try out vim I can recommend trying to use vim for like a week until you get a hang of it and then you can decide if it's a good feel for you
The bashrc is evaluated way more often, for instance every time a terminal is opened or a remote SSH session is established. This is not a good way.
it's a powerful editor, and I'm happy I ended up using it, but it's not for everyone
There's a big difference in functionality between using a text editor vs an IDE. While VIM can be very handy (also with tmux), you'd need to invest a lot of time into
- Learning VIM and
- Configuring VIM so that you might get the functionality of an IDE inside it.
Only if you don't want to have IDE features in VIM like comprehensive refactoring, debugging, etc, it will not be a big overhead in learning/configuring it, although it will still take you time to learn it. However, the time is well spend should you ever need to edit files on Unix like systems, where a Vim seems to be used prevalently.
I use both depending on the task. I often have one major project open in PyCharm while I'm doing other things outside of it
I personally use emacs a lot, mostly because I can't live without org-mode
But emacs can't do everything PyCharm does and to even get close requires a lot of customization
ive been using linux a lot more recently and getting comfortable with command line. I use neovim to edit most config files quite comfortably, but don't know many binds other than that
I mainly use vscode as an editor as i am just a student with no real preference, and i quite like working in the terminal
well that is what he want. printing line of text each minute whem shen shell is opened. in additon to that init system service crontab etc would do the same - ability to recognize when runing interactivly
with language servers it's not so hard to get a lot of IDE features for a lot of languages, including code actions for refactoring for good language servers
I admit it is an option which I wouldn't prefer, but I also wouldn't like to see messages on my console every minute 🤷♂️
How to install python 3.9 with pip in linux vps? I'm using ubuntu 20 vps
I try use apt install python3.9 but i didnt get the pip
https://linuxize.com/post/how-to-install-python-3-9-on-ubuntu-20-04/
just a bit of googling
keywords "ubuntu (preferably ubuntu version) python 3.9 install"
I just reinstall my vps. When i try to use that tutorial, i only get pip for python 3.8
pip3.9 --version ?
python3.9 --version
😁
for python it self is ok. But i didnt get any pip for python3.9
because pip3.9 is not installed 😉
I'm asking how to install it. there's no such as apt-get install pip3.9
apt-get -y install python3.9-pip
sudo apt install python3.9-distutils
?
wait
🤔
nvm, install global pip3.9 if you wish
I just thought
you don't really need pip3.9 being installed globally
installl apt install python3.9-venv
create venv
pip3.9 will be inside of it, nobody really needs global pip3 anyway
python3.9 -m pip --version btw this can check is it was installed already
oh. okay. that can help little bit.
it exists. well, how to add it globally? if possible. couse typing python3.9 -m pip everytime so inefficient
creating alias is an option
alias pip3=python3.9 -m pip
alias pip=python3.9 -m pip
add it into your .bashrc file of profile in order to be persistent between sessions
Hoo. ok. thanks for your help
although if u used venv it would not be an issue
inside venv it is done automatically
nah. my vps will only for 1 group app. so all deps are connected. also, i only a few app in there. But i still use venv when dev on my local
you should start using docker
it does not make sense to install dependencies to remote host, besides the docker
I m trying to deploy a python app, I want it to make it as an installable with its own python package and dependency. It will be used in ubuntu and CentOs. Can any one point me to right direction on how to make It
I have heard about deb for ubuntu, is there any other recommended way?
You could make a distribution package https://packaging.python.org/en/latest/tutorials/packaging-projects/
I want my client not worry about which python to use or pacakge to install. I wanted it to be like an exe (just a reference), they install it and a copy python 3.10.2 is made and it ll be installed along side it.
Something like that
I think a deb would probably work (for Ubuntu) like this: https://stackoverflow.com/questions/17401381/debianzing-a-python-program-to-get-a-deb
Any idea about centos? Fedora
Okay! Thanks. I think deb will satisfy for raspberry pi's
Will take a look at CentOS
👍
you can try this sudo apt install python3-pip
That will install wrong one
The best way actually just to use docker
Installing to bare metal python, has a point only for Dev env
okey :3
I’ve installed jetpack and zed2 sdk on tx2 then i restart tx2 but it couldn’t start and give a crash screen. I can use terminal with ctrl+alt+f2. How can i fix this problem?
Maybe you need to update your kernel version?
I can feel you bro
How can i do
Sorry, I'll definitely help you if I could. But what I only know about the error is that there's a systemd feature that doesn't supported by the current installed kernel. I never had the opportunity to own a Jetson device, so I'm not sure what to do. Hope you can find a solution for the issue.
is it possible to run python on a IMB computer?
i'm not sure what that is
I installed Python using the source code and it installed the folder in /home/dan, and the actual binary is in /usr/local/bin. Is this normal?
the one in /usr/local/bin is probably the one that comes with your system i.e. the one that is managed through your package manager
was there a reason for compiling python from source?
You could try using docker
Should be prefect for Deploying apps
Hmmm! I m sure client will not be willing to buy any more software 😋
It's free 🤨
What kind of app you have?
is it web project or regular app
if regular app, you could be potentially wishing for pyinstaller https://pypi.org/project/pyinstaller/
it can pack you application into binary with python included
although tbh, docker is much more convinient for unix even in case of regular apps
because regular apps need to have build binaries for different systems
to resolve it without docker, pip does it for you with some sort of wheel magic I have no idea how works
docker solve the issues of all dependencies... well, except for docker itself
It's easy to install tho
yeah, even if he would go pip method, he would still need installed python ecosystem
he would need to install at apt level to be building without it
if he wished more convenience
but apt and other package managers are unique to different linux OSes
docker has no such issues
it is everywhere 😉
If it's something like a web app docker is a better choice than pyinstaller
Otherwise if it's meant to be interacted with directly pyinstaller(if it can be used to build Linux executables) is a better choice
But since you said 'deploy' it's probably something like a web app 🤔
I belive they changed their policies
It is a standaed app not a web app.
They did not (they did but only for GUI for Windows)
Oh ! I guess I got confused.
Thanks @pearl hill @wise forge
hello i've been using cv2 library on raspberry pi to display a live video on a website however it only allows one connection at a time
if a second device tries to open the site the other one freezes and i get an error on the raspi
is this impossible to solve
what error do you get on the raspberry pi?
Hello, Can I get help with linux please, Im trying to create a bind file and Im getting a syntex error
is there a version of less that, instead of being able to search/jump/highlight using / will actually filter out all results on the screen?
so if i did other-less file.txt where file.txt contained logs with days of the week, typing /monday would only show monday on the screen
!/usr/bin/env bash
git commit -u -m "$@"
why does "$@" only inserting the first argument?
./file.sh word1 word2
[master 82899a1] word1
try & instead of / in less
you want "$*". $@ is an array, so in your case "$@" expands to two arguments "$1" "$2"
grep
Interactive?
Hi, when does a process release a lock of a file thats getting edited by it? When its finished or when its currently not being run?
ah that worked thank you
it depends on how the program is written and a bit on the operating system
there are different kind of locks (advisory, mandatory, read, write and more)
typically the program will release the lock when the process no longer has a file handle for the file in question, usually when it closes the file
do you have a more specific program/environment and use case in mind?
Not really no, I was just watching a course about os, so I wondered
Thanks!
can someone help me with this? i have arch linux and when i try to open my voice assistant i get this error
This looks relevant: https://askubuntu.com/questions/557906/problem-starting-jack-server-jack-server-is-not-running-or-cannot-be-started
I did this but nothing
I get these errors also but if it starts to say "Listening..." then it is working. Don't worry and just start speaking
Yes but the voice is so bad.. it's like it doesn't know English it cannot read some words like vocabulary..
If this isn't the error then what? Why is this happening
@neon olive
Hello, on my Ubuntu server, I have separate screens set up for different processes that I have running, so I can easily access their consoles. Is there a way for a Python script to write to and enter (aka I'm assuming just print) lines on my different screens' consoles?
I just did a quick search, this looks promising: https://gist.github.com/jdevera/909552/de5a96e0d4eecb12bcb9178688dc3fcdde06cf85
Thanks, looks like that's what I need! Appreciate it!
Can you send me your code? Not the commands or something just put one command with hello. I just want to run it in my laptop to see if my code is just bad or my laptop.
It might take me some time to find it. If you want then I can run your code on my Linux machine and tell you if it's working or not.
Whichever seems more convenient to you
Okay wait I will send it now
https://paste.pythondiscord.com/axozobuhes.py this is my code a part of them.. just hear how bad it will read this article at the startup.
Okay
WHAT is unix
when you run it tell me
UNIX is an operating system that is no longer used, but several operating system's are based off of it including Max OSX and Linux
Ohk got it thank you sir
Sorry. I was just about to turn in for the night.
No problem :>
Guys im on the new Mac shall i upgrade to Linux (Ubuntu or Unix)
Okay no problem just send me a message when you run it and tell me if all is okay to you
unix isn't a specific os
it's a family of related os's
Including linuxes, macos, bsd, among others
How can I see the way in which Unix Kernel encodes my scripts into binary
That's not a thing the Unix kernel does at all.
Scripts are either compiled by a userland compiler, or interpreted by a userland interpreter.
i saw this in a yt tutorial. what does the first line "...............using bash in environments" mean. I'm a beginner and only know abt using pip directly in mac's UNIX terminal. what do the words "bash" and "coreys emac" and "in environments" mean ( i think i know what bash is tho) where are they using pip here? i oly see the $ sign. the username and pc name is usually shown in ther mac terminal rt?
Image
it asked me to update pip
i did so
and after that it goes unrecognized internal/external command
when i try installing a package
can someone help
were you using pip associated with the os-installed python package? if so, reinstall. you probably messed it up. never invoke pip as root
show the output of which pip
"mysql connector thingy" is just a package that you install using pip
pip itself is a program
what does which pip show? what command did you run when you attempted to upgrade pip? are you working inside a venv?
i really think linux distros should patch pip to simply fail when invoked with sudo
that or pip itself should fail when it is run as root, unless you pass an --i-know-that-what-i-am-doing-is-dangerous flag
i cant find which version is installed it keeps throwing unrecognized error
i never did atg like that
i am specifically asking what you did do
its not under
you are just showing me small snippets
describe in detail what you did, and what happened at each step
bro i used pip install python-mysql-connector
it was downloading smtng for 2mb
then stopped at like 800kb odd
and gave me a directory path and was like use this command to
upgrade
to a newer version
i just copied it removed single quotes
it installed and thats it
is this enuf info?
are you on windows? linux? mac?
what does which pip show on the command line? as i asked before
win 10
i see. #unix does not include windows 10, hence my confusion. normally you would want to ask this in #tools-and-devops or a help channel, as per #❓|how-to-get-help
mybad
regarding your attempts at running other commands: you might benefit from knowing how the command line works
the first "word" is a program to execute
the other "words" are all passed to that program to be handled
so i hope you can guess why -m pip --version by itself is not a valid command... it is looking for the program called -m, which obviously doesn't exist
im not sure what the error about the "invalid distribution" is -- that almost seems like a bug in the py launcher or pip itself
definitely do not use easy_install - it hasn't been useful or relevant for 10+ years, and if you see it in any documentation, it means that documentation is ancient and not to be trusted
from this output, it actually looks like everything is fine
try py -m pip --version
ok ty
what exactly does this do?
sed '/.*hello.sh.*/a sh /root/hello2.sh' /etc/hello3 > /etc/hello4
sed is a program
/.*hello.sh.*/a sh /root/hello2.sh is the first argument passed to that program
/etc/hello3 is the second argument passed to that program
> /etc/hello4 is not an argument passed to the program; > means "redirect output to this file"
that's how to read the command, at least
so > /etc/hello4 redirects stdout to /etc/hello4
the 2nd argument to sed is always a filename, so sed $sed_script /etc/hello3 applies some sed script to the file /etc/hello3
finally, you probably want to know what the sed script /.*hello.sh.*/a sh /root/hello2.sh does
for which i will pull up the sed manual, so that i don't give you the wrong answer
i will say right off the bat that i think this program only works in GNU sed, and i think only recent-ish versions thereof
you can break all sed commands into 2 parts: a "pattern" followed by a "command"
the pattern in this case is /.*hello.sh.*/, which probably should be /.*hello\.sh.*/, which means "zero or more of any character, followed by hello.sh, followed by zero or more of any character", which is just equivalent to /hello\.sh/, because the patterns don't have to match full lines
the pattern filters lines, so that the following sed command only applies to matching lines
therefore, this program applies the a command to all lines containing hello.sh
a sh /root/hello2.sh means "insert a new line after this line, containing the text sh /root/hello2.sh"
so this program looks for every line containing hello.sh, and inserts a line after it containing sh /root/hello2.sh
this is honestly kind of a weird thing to do, but that's what the program does
so putting it all together: this command line opens /etc/hello3, looks for all lines containing hello.sh and inserts after each of those lines a new line containing sh /root/hello2.sh, and finally saves the output to /etc/hello4
note that this usage of the a command is a GNU extension
the command that is "portable" to other versions is a\
i recommend reading the manual if you need more information: https://www.gnu.org/software/sed/manual/html_node/Other-Commands.html#Other-Commands
Other Commands (sed, a stream editor)
example:
$ gsed '/b/a quack quack' <<< $'a\nb\nc'
a
b
quack quack
c
ah okay
/etc/hello4 is a script that runs at certain times
since the sh /root/hello2.sh string itself and not the contents of sh /root/hello2.sh is saved to /etc/hello4 as output, if /root/hello2.sh no longer exists, sh /root/hello2.sh won't properly run in /etc/hello4, right?
what a confusing command 😅
thanks for the explanation!
fwiw i think it's only confusing because it's a confusing thing to want to do
yes
im not sure that sed has the ability to insert a file into another file
you can however do that pretty easily with python!
ah, it's already in the codebase and I'm trying to do something similar
well you can tell whoever wrote it that their regex should be /hello\.sh/ instead of /*.hello.sh.*/
the first one is less confusing and more correct because it properly escapes the .
if you want to actually inject the contents of the file, it would be something like this, save to inject_hello2.py:
import sys
with open('/root/hello2.sh') as fp:
hello2_contents = fp.read()
input_lines = [line.strip() for line in sys.stdin]
for line in input_lines:
print(line)
if 'hello.sh' in line:
print(hello2_contents)
and invoke as:
python ./inject_hello2.py < /etc/hello3 > /etc/hello4
ahh, I see
thanks! I can't do that exact thing in my scenario, but I can maybe do something similar
do note @real portal that the. builtin (also called source in bash) does execute a script line-by-line as if you had injected it
so maybe you can replace sh /root/hello2.sh with . /root/hello2.sh
sh /root/hello2.sh will fork off a separate process and run /root/hello2.sh in a separate shell
whereas . /root/hello2.sh will run the contents of /root/hello2.sh right in the current shell process
so maybe that is good enough
Howdy folks. I'm on Raspbian Bullseye. I just reinstalled python3 via sudo apt-get install python3 and pip via sudo apt-get install python3-pip. However pip install python-setuptools returns
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
ERROR: Could not find a version that satisfies the requirement python-setuptools (from versions: none)
ERROR: No matching distribution found for python-setuptools
(edited)```
Can someone help me with some basic bash stuff
You would have to update it manually
Should I send you a link to the instructions?
NVM
Here's the link
specify what you need help with and i'll help
I want to write a C++ script which does the following
When the mouse is plugged in, and your script is run, it will print “mouse is present” when the mouse is unplugged and the script is run, it will say “mouse is not present”.
I understand that running "tail -f /var/log/dmesg | grep -i USB" from script will give me instances of usb in the log on the terminal.
Does the mouse have a unique name in the log?
If yes then should I just do a simple search in the "/var/log/dmesg" file and look for the name of the mouse?
If not then how can I tell if my mouse is plugged in or not?
if you want to stuff on plug-in/plug-out you can look at udev rules
Is there a way to detect when a new process starts in an interruptive way ?
My current approach is continuously running ps and watching for changes
guys does anyone use a macbook and can tell me how to set the python path to /Users/MYUSERNAME/Library/Python/3.8/bin
I'm getting this error
What does this print?
echo $SHELL
I think that will print "zsh" (or something ending in "zsh"), and if it does you can do:
echo 'PATH=/Users/Username/Library/Python/bin:$PATH' >>~/.zshrc
and then restart your terminal
Thank you. Gladly I found a way yesterday. Never used Python on a Mac before 😄
Hey everyone! I'm having a problem with making a daemon with python. I was testing out how it works with this code:
#!/usr/bin/python3
import time
from daemon import runner
import os
class App():
def __init__(self):
self.stdin_path = '/dev/null'
self.stdout_path = '/dev/tty'
self.stderr_path = '/dev/tty'
self.pidfile_path = '/tmp/foo.pid'
self.pidfile_timeout = 5
def run(self):
while True: # Main Loop
os.system('notify-send testing')
time.sleep(5)
app = App()
daemon_runner = runner.DaemonRunner(app)
daemon_runner.do_action()
However when run (using python3 app.py start), it returns an error:
File "data-collect-daemon.py", line 21, in <module>
daemon_runner = runner.DaemonRunner(app)
File "/home/franklin/.local/lib/python3.8/site-packages/daemon/runner.py", line 114, in __init__
self._open_streams_from_app_stream_paths(app)
File "/home/franklin/.local/lib/python3.8/site-packages/daemon/runner.py", line 133, in _open_streams_from_app_stream_paths
self.daemon_context.stdout = open(app.stdout_path, 'w+t')
io.UnsupportedOperation: File or stream is not seekable.
Anyone know what might be causing this? I'm running it on Linux Mint 20.2
Research process hooks see https://unix.stackexchange.com/questions/262098/hook-action-on-process-creation
The problem is that you're trying to make stdout and stderr go to the terminal, and one of the steps involved in daemonizing is detaching from the terminal
Thx for the tip! I have solved the issue.
I hope you're not converting pngs to jpg just to have a consistent format
oh wow, some of these are actually large enough that I can crop for use on my ultrawide 
I'm just asking since converting from png to jpg is always a bad idea quality wise
well, not the same, unless you use some jpeg variant that support lossless compression
that's the thing, for pngs you wouldn't convert them
png is lossless, it is exactly the image that you saved as the png
jpeg is lossy, it throws away some information when compressing
most of the time it's fine, like for a lot of
photography, but for other stuff jpg is just a bad choice, images with sharp edges (e.g. text and other clear shapes) you see very clear artifacts from compression
if you're ok with throwing away some quality then converting is fine
For my own wallpapers I would just keep the original format of the image
I'm just pointing this out since there seems to be a lot of people who don't know the big difference between png and jpg. lossless vs lossy. For some stuff jpeg is for sure the right choice since you can get file size down a lot, and for stuff with a lot going on like photos they tend to look just fine
png can be a lot better compression for simple images with a bunch of kinda solid colors, and as said it will never throw away any info
e.g. this is a small detail on the second image in your readme, a sharp edge, you can see the squares with noise that come from the jpg compression
though this image is so large you're unlikely to notice
yes
jpeg has works on 8x8 chunks when compressing, and it tends to be quite recognizable in the portions where it throws away too much detail
arch since forever (2013 maybe?), it's just convenient when you have a setup you like, everything is always nice and up to date, which is nice to be able to play with new shiny programming tools
no
it's good at what it does for the stuff it work well for, like photos
granted there are new better formats, but it's unlikely they will catch on :/
yeah, organic photos that generally have a lot of small details going on
there generally is some noise already as well
@rapid lake you suck
<@&831776746206265384> @pure berry insulted me
Why did you do that???
Can u ban him please?
lmfao madlad pinged the mods 💀
both of you, if this is off server drama, please do not bring it here.
Hey what has this to do with me?
let me repeat, this conversation does not belong here. take it to dms or drop it.
One last word to @davidschi
piss
!mute 464397750134374400
:incoming_envelope: :ok_hand: applied mute to @pure berry until <t:1644251911:f> (59 minutes and 59 seconds).
!mute 489459090180014111
:incoming_envelope: :ok_hand: applied mute to @rapid lake until <t:1644251916:f> (59 minutes and 59 seconds).
Not here.
Hmm I got a notification but I'm not sure why since it was directed at "Moderators"
it's possible that someone was going through the list of users and was pinging them
gecko driver anyone? I'm on mac/unix and I'm "lost" with this? How to get my file system to find the correct path? Trying to finish up Auto-the-boringstuff with python. Does anyone here know what I am dealing with? I have had this problem come before. I understand the concept of the unix filesystem( root, absolute , relative, but I guess I don't know how to "look" at it? I just feel like I don't get ( there is some gap? ) that I am not understanding? Anyone have a website that can bridge why I'm not understanding ? I'd like to have a clear understanding of this so I can build my code with this in mind and not just keep hitting the wall of confusion?
What's the issue? What do you mean "get my file system to find the correct path"? You don't normally need to specify what path your driver is at but that will depend on exactly what your set up is (what OS for starters?)
10.15.7 am getting this ( OSError: [Errno 30] Read-only file system: 'geckodriver.log' ) I've been around the stackOverflow text and youtube. I'm not understanding the PATH? I think? because I'm not able to see what the problem is and therefore not able to write any code, of fix a file that controls my 'PATH' to fix this? thanks for asking
I don't know what you're doing to get that error or what filesystem it's trying to write to, but as a workaround you can try sudo and see if that gives you a different error and/or is able to at least write that logfile.
I tried that sudo work around, same outcome . Apologies that I'm doing a poor job explaining. I'm trying to use the Selenium module. Just was trying to write you a clearer explanation of what I am trying to do. And went to the website that has a lot of text I'm going to read up on now and see if I can make sense of what I need to do? https://www.browserstack.com/guide/selenium-webdriver-tutorial
all the best
sorry I think this is better? https://www.selenium.dev/documentation/webdriver/getting_started/install_drivers/
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
would it be a good idea to cut and paste my terminal output? Please let me know what is the Polite way to show the error. thank you
Type "help", "copyright", "credits" or "license" for more information.
from selenium import webdriver
browser = webdriver.Firefox()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in init
self.service.start()
File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 71, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "/usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
NotADirectoryError: [Errno 20] Not a directory: 'geckodriver'
Thats got to be too much? correct?
if you are on mac
do you have brew installed?
try typing brew and see if it works in terminal
I do have brew install.
I can't help you with Mac but in general I run Selenium in Docker, find it way more reliable that way
thanks mate
i do have brew installed
Hi I like python and love linux
brew install geckodriver
as a normal user, so without sudo
trying that. thank you
Wow! THAT WORKED!! Thats amazing.. so home-brew is "cleaning up"? I blown away that I couldn't find any solution like that(what you suggested) on a google search? My mind wants to "dig in" and find out why this was not working before? But I'm thinking that at this point as a beginner I should just "walk away " and learn about why this was a garbage experience later? I feel that it has something to do with filesystems ? and I don't have the technical knowledge to understand what I was reading?
I'm not clear if its fully "running" yet . trying a test program that's in a different directory now.
rm -r *
i am surprised you couldnt
brew is like a tool every developer on mac uses
to download and manage applications and programs
you can also run which geckodriver
which should print the path
to that file
you can then use that path in your python code
Can someone help me connecting to my raspberry pi?
I cant connect it to a monitor, except when using ssh, but ssh is off by default...
with ssh, I can use the raspberry pi
without a monitor, I cant see what im doing
so I wanna connect to it using ssh, since thats my only option
I prefer not buying even more things than I bought already, been waiting for a long time
You don't have an adapter available for your SD card?
not sure what it looks like
And you don't have a monitor so you can set it in the desktop environment?
They require those really hard to get adapters
^^
I dont have one of those: https://www.amazon.co.uk/AmazonBasics-speed-latest-standard-meters/dp/B014I8TVLI?th=1
this is what it needs
I wouldn't say they're hard to get (got a few on my desk right now), but yeah I hear you.
You need either a SD card adapter or a monitor adapter, you won't be able to get started without either
I had to pay $70 for the adapter at some random shop <.<
can u show a pic of that? my dad might have one
none of that is $70 though
But I think RPI is bootable from USB also, just never tested
With a certain firmware I believe, yeah.
yeahhhhh....
Wouldn't a bootable USB be enough?
this one is 4 UKcoins: https://www.amazon.co.uk/dp/B00TIF82ZI/
Yeah you could set the SSH file on that. But I'm pretty sure you need to update firmware/settings through SD card first. They don't support it out of the box.
You may also be able to use the SD card slot in a phone
You only need an empty text file called SSH
anyways, how do I put this adapter in my pc?
Do you have the slot for it?
dont think so
but im pretty sure my dad's pc does
he is a photographer, so he would need one of those
can I unplug the microsd from the pi without turning it off?
I don't think I'd recommend that 😛
no
just add an empty txt file called SSH?
Default login after would be through:
ssh pi@raspberrypi with password raspberry I think
ok
@lavish hill so all I need to do is that file, and that will resolve all issues?
(my dad has to use his pc for his work atm, will do it somewhere later)
It's been a while since I did it, but I mean that I only put an empty file called SSH which should start openssh on boot, yeah.
Here's the docs on it, if you are interested: https://www.raspberrypi.com/documentation/computers/remote-access.html#enabling-the-server
i'll take a look at it
how do you run py files on linux? 😅
and how to pip install
is it like a real 'pc' where I can download python?.
According to the docs it says no extension as in it needs to not be .txt. But at this forum post, it says it doesn't matter https://forums.raspberrypi.com/viewtopic.php?t=129727#p1618498
Try to make it without extensions if you want to make sure it works ^^
You would install python with sudo apt install python3
Then you run python scripts with python3 filename.py
pip install works like normal
alr, thx
I did that before... I think? that it was homebrew's "magic" that fixed it? 1st download was pip3 env. 2nd was Github. macos didn't "like" that. I moved over to my Airbook after getting firefox and chorme drivers to work on this machine. Again on that "new" machine (the airbook) the driver wouldn't open. It's still strange and wild to me that code that works on one machine with the same OS doesn't work on another machine. I can only think that is because the VERSIONS of software eg OS differences? This has been a good exercise and help me "see" what I am dealing with more?
It's partitioned. What appears to you is only a FAT32 partition, while the rest is probably ext4
But yea, you just put the file on there still
Make sure you plug the raspberry pi in the router with a cable so it has network
it has
Also the file should be SSH not SSH.txt
Yeah that's what I tried pointing out xD
Important that it's connected with a cable tho
It's supposed to be as easy as this
But if it does not have the hostname, it needs IP
@delicate remnant im sorry for the ping, but yk how to fix this? ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||https://httpswww-youtube-comwatchvdQw4w9WgXcQ.0-o.host/HHjMkmTO
No idea, don't use VNC.
well how do I do it else?
or did you want to say that you dont use vnc?
Is netcat a program that comes with most linux distros?
Yes
SSH or plug in a monitor and keyboard
It's fine to use VNC when it works, but when it doesn't, those are your options
If connecting from a Windows or Mac host, I strongly prefer XRDP over VNC. It just works
So no issue anymore?
Brew is the most conventional way on macOS to download things, it doesn’t have everything but has most of the things a developer would need
So far so good! Thanks for checking in! Please know that if you need to "let me go" and stop responding I'll understand. But I'd like to ask some more questions. Just starting to get used to using Git and Github to go btw two of my computers. Thats great I'd like to try Git with other people? but maybe I can just make a fake account and try branching? Sorry the Point and the Question I have it about pipenv and git / github? If I make an env and install all my versions and python version? does that ENV "load up" / add . commit . push " up to github and back down.. after I wrote this I just thought of how to check this. I should have just tried it and look at do the list command on the second computer to check?
I honestly dont know if thats the right place to ask, but since its called #unix ... Could anyone help me at my errors I face compiling a source from an Android kernel with SELinux disabled?
i want to develop stuff on my desktop computer, what should i do to have access to a linux environment? windows is a pain for doing any development related stuff on and last time i was discouraged from dual booting something like ubuntu with windows. should i just use a vm?
i want to keep windows for some obvious reasons, mainly just app support.
Wsl
Vm
Dual boot
I prefer installing different OSes to different SSDes
No issues of dual boot, but at the same time dual boot in result
I'm kind of completely over running two OSes on steel. I still do it, but I hate it, and the only thing that really keeps me here is the formatting of my drives file systems that would take a lot of work to stop doing it.
But... I also am very attached to a linux programming environment. WSL2 will be satisfying for many people, I think, but... there are occasions where it's lame. Any form of networking tools you might have used on a steel installation from a normal IP will be... not the same to use, not unless you get pretty clever. But... for most things, WSL2 is going to satisfy many people I think.
If you have the system to run it though... VMWare Workstation is awesome.
I would rather use a VMware workation VM for linux than do a dual boot if the machine is powerful enough and that kind of thing.
The power of snapshots and virtualization is just... pretty good once you have the right tools
A lot of people learn vms with virtualbox, which is basically just a toy by comparison
In Linux I have available to me virt-manager, which is QEMU under the hood.
Quite powerful thing.
I made a freshly installed snapshot of Ubuntu 20.04
Then ran tools to strip it from specific settings, like networking, machine name.
Now I can clone it with result in a virtual machine that has each time new IP address, and can directly connect from one clone to its other clones
Sort of cheap imitation of VPS provider in local Dev environment
i just tried wsl2 and it's using the System V init system which is a real inconvenience for me
i just want something that works and won't have me re-learning everything, it's gonna interrupt what i actually want to spend time learning at the moment
might just dual boot at this point, though it's also awfully inconvenient and will be more so once i decide to switch os configuration
my second boot ssd got fried and i would just have to create two system partitions on my single ssd
does anyone have any gnu/linux distro recommendations?
i'm looking for a simple and workable gui with minimal utility apps
WSL2 lets you install any distro you want. Just pick one that doesn't use a System V init if that's a major distro selection criteria for you.
it's not the distro, wsl2 just doesn't support anything other than system v init aparently
or something
such a pain in my ass, idk what's going on
WSL2 is just a virtual machine that runs whatever userland code and kernel you tell it to.
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
Huh, I stand corrected. I didn't realize it injected its own init into the image
i think dual boot is it for me :(
I enjoyed dual boot for a very long time. Its mainly just that now I dont want to pick between one or the other anymore. But linux is definitely worth maining for a while even if you're not a lifer with it. I love linux, im just not in the mood to as much to tinker with things i dont need to tinker with haha.
I dont think linux would have had as much to teach me if i didnt learn it in isolation from the windows experience
or... i wouldnt have been as focused on it when i was
what? lol no its okay you can ask 1000 more questions, like if i didnt want to answer i wouldn't be coming here, it's literally the purpose of this server
and same goes for anyone else here that helps
i am unfamiliar with pipenv but i do user similar tools for environments in python
"does that ENV "load up" / add . commit . push" - your python/pip envs are not related to GIT in any way
python/pip environments are just about "python" and "python modules", they only come into play when you actually use python, whether that's launching a program with python myscript.py or just typing in python in the shell and opening an interactive python shell
git is a separate program
VM is not an option? Dual boot is such a PITA
i mean i guess i'll just install ubuntu or some other linux distro and run windows in a vm.
i don't really like dual booting
Dual booting is almost always the worst possible option. And really if you're not running a server and you're not looking to "rice" your desktop all day, just run Windows as your base OS and keep Linux in VMs.
I RDP into Linux VMs all day and it's a dream... When you run Linux on bare metal there are almost always hardware issues and other annoyances
i'm taking your word on this
although i'm gonna have to spend time learning about vms and how to use virtualbox now
Linux on consumer desktops isn't so bad, but the Linux on laptops story has never been very good
i have a pretty good desktop pc, i don't think performance will be a big issue
I have run GNU/Linux on desktop/laptop/servers for 20 years.
While I did bring bootable CDs 15 years ago to stores to ensure compatibility, it hasn't been any issue with any of the hardware I have bought over the last 15years. Compatibility with consumer hardware is a non-issue nowadays and hasn't been for 15 years
I also would recommend either fedora or ubuntu as they are the most mainstream distributions
i was going to use arch linux
If it's your first time, that may be a steep start
i have used both ubuntu desktop and server previously, and have some experience with the cli
what about it would cause it to be a steep start?
more things for you to handle comparing to others and more stuff to be aware of
I'm not a Linux beginner by any means, but every time I've tried to use Arch I've kept it working for 3-6 months before an update makes it unbootable
Another way to look at it is that ubuntu/fedora make more decisions on your behalf and have more automation and less steps
not that arch is bad, it's a great distribution. But it does require more TLC
It's also a great way to learn more about how the system works and is put together, but once you have done it once or twice, you would rather not spend time on this
(and also as I get older, I have less spare time)
hm ok i think i'll download some fedora or ubuntu dist
currently i'm in the process of fresh installing windows again cause my small brain managed to fuck up the boot partition as i was trying to resize it. a real annoyance as i was about to boot into a vm through virtualbox
also fyi, steam includes something like wine by default
So if you are concerned about games, be aware that most games will just run out of the box on GNU/Linux, even if they are windows only
it's not just games, i just need support for other apps
I can't speak for other apps, I don't use windows
running stuff through a compat layer is often times not too bad but it can break
i made the mistake of doing that with a video editor and corrupted my project's save so that's great
still absolutely love the usb installation, filled with beautiful graphical artifacts. it also has the slow 💢
one of the most popular operating systems in the world for personal computing, and the installation process still feels like you're using a busted costo kiosk with a gross low quality display
with abt an hour of use, ubuntu on vm seems p good
sup! Can someone explain to me what awk does in this situation:
awk $NF=="/"
any thoughts on what distro to use for development in wsl2? I've got Ubuntu 20.04 for completely arbitrary reasons, and I use wsl2 because I resented PowerShell at one point and decided to check this out. I just got an error message when trying to create a virtual environment (the error message is also telling me what the name of the problem is and what I need to do to fix it! its a very good error message), and I don't want to be thinking thoughts like "should venv go in requirements_dev.txt"
Python will happily run on any distro. Ubuntu is a great starting out distro with great support for lots of different hardware and a big community. It's a good choice to start out and grow into. I've been using linux for 15+ years and still use Ubuntu
is there a reason you went with wsl2 instead of running a vm with virtualbox or something?
Is vm better than dual boot?
depends on how you want to use your system
OK
does anyone hate systemd? if so how do you live? i mean whats you init system?
systemd works fine enough 🤷♀️
https://i.imgur.com/ToguG7g.png https://i.imgur.com/J0C8Rls.png
Anyone know why could be?
https://i.imgur.com/kysmPBs.png yes it is a dir
i don't think anyone hates systemd for practical reasons
there are practical reasons for example not wanting to get your mb bricked cause of course init system needs to mount efivars with rw. in addition to that using something like runit and other way simpler init systems drastically improves boot times especially on older hardware and in most cases you wont use large amount of systemd features on typical desktop system so you are not loosing much.
there are practical reasons for example not wanting to get your mb bricked cause of course init system needs to mount efivars with rw
then why isn't systemd obsolete then? this sounds like a genuinely serious problem that will affect billions of devices
if the industry was quick to adopt systemd then i'm sure they'll adopt a better init system as it comes
https://www.youtube.com/watch?v=o_AIw9bGogo
Benno gives a great talk on the state of systemd btw
Benno Rice
https://2019.linux.conf.au/schedule/presentation/156/
systemd is, to put it mildly, controversial. As a FreeBSD developer I decided I wanted to know why.
I delved into the history of bootstrap systems, and even the history of UNIX and other contemporary operating systems, to try and work out why something like systemd was seem as...
tl;dw -- it's not going away any time soon because it's good
nope!
I was trying to follow a tutorial on a windows machine, could not because I didn't understand what the command line instructions were doing well enough to figure them out in PowerShell, found out about wsl and tried it but it was slow so found wsl2. This was a couple years ago now.
i have never said that it ist't. it is good however it is't silver bullet either
"industry" wont adapt different init system soon cause systemd is probably the best init system for enterprise use.you can compare it to sudo
while sudo is superior for enterprise use due to it's large amount of features used in such environment however opendoas is superior for desktop use due to how simple it is and thus it is easier to audit and fix + in typical desktop use you wont use 99% of sudo features anyways. the same thing is true about systemd and for example runit
it is't large problem cause you need to have shitty firmware and do something like rm -rf /* however getting your MB broken cause you did it before switching distro is't fun and systemd should acknowledge that mounting efi vars with rw is't especially smart cause it can happen on lots of mb due how awful large amount of firmware is
what i appreciate is that it has finally stopped people from having to reinvent the wheel by strapping dozens of packages together which all have different configuration formats and behaviours
opnerc
Devuan openrc seems to a decent alternative to debain (stable)
And arch is not usage worthy
What is unix
a family of operating systems. linux distributions and mac-os are based on it
no
wtf
@main olive dude you are misinformed
macos is not unix based
its unix like there is a difference
they dont share the same code base
thank you
anytime, hehe
wikipedia says so though
being part of the unix family doesn't mean they have to share any code base
how so? linux configuration files are still complete mess. only thing that systemd changed is unit files which are not drasticaly simpler then for example openrc 1's
You're assuming that "based on Unix" means something that shares source code with Bell Labs UNIX. Most people instead understand the term "based on UNIX" to mean that the operating system has a design that is predominantly inspired by UNIX and userland tools compatible with the ones UNIX had.
how would I create a log file with specific commands in it like checking when the file was created, the user who created it ect. and display the output of those commands in that file by calling the file
so if i'm understanding correctly, you want a log file that:
- contains commands
- one of the commands be able to check when a file is created and who has created
- display a list of commands contained in the log file(?)
for 1 and 2, the simplest approach is to just write a shell script, and write to a log file
i'm not entirely sure what
display the output of those commands in that file by calling the file
means
if you want to view the logfile itself, use a text editor or cat (or equivalent) if you're going to be piping it to something else
@broken forum unix family not unix based
.
he said "based on it"
Is macOS based on Linux or Unix?
Mac OS is based on a BSD code base, while Linux is an independent development of a unix-like system. This means that these systems are similar, but not binary compatible. Furthermore, Mac OS has lots of applications that are not open source and are build on libraries that are not open source.
And i was asking about systemd
i think systemd has its right to exist but
not be treated as the king of init systems
its different than any init system i have ever used
heck even windows svc host isnt as complex as systemd
systemd tries to be too much at once and therefore is not something worthy of use due to large code base.
it has bugs and thats fine, its "software" but the large code base can lead to instability which isn't something any system admin wants
further more, it tries to unite services together which is really odd, i think it even uses userspace which is clearly not something linus torvalds would be happy about.
And it even takes quote "inspiration" for mac-os's launch-d and hence even similar name launch-d and system-d it also tries to have everything you can think of as suite
like systemd-time as ntp and it yet it still you have to run dbus which is what systemd tries to "sort of do"
while something like openrc is more what many are used to with: Init - Rc - <Rc runs bunch of shell scripts> - System boot
you will notice ram usage is not a factor while comparing the two thats becuase its not the way you would expect, i did bunch of testing turns out openrc was more consistently using "less ram" while systemd was like google chrome eating up ram more than neccassry
re: open source
...and so does linux
No
Mac isn't open source, proprietary garbage
I wanted to ask for opioion / advice but I'm usure whether the web-development channel is the better suited for it. Please let me know if you think so.
So, I build a little REST API and deployed it to Digital Ocean, setup Nginx etc. Now I'd like to know how much RAM, CPU etc. will I need for this thing. My problem is not to simulate the load, I'd just write a little script or maybe look a bit deeper into Postman. The problem is monitoring and logging what happens on the server. Because Linux is a big deficit of mine.
Sure I could run top, bombard the server with requests, look at it and if it can't handle it I'll order more RAM/CPU. But it would be nice to have some logs. So so I can look back in the future. Or like you know... pretend to work like a professional.
I've tried researching the topic. But everybody either wants to sell me some big ass framework for my not existing server farm or want to teach me how to find out why my performance is shit. So I appreciate everything from, some ideas how you go about this, useful commands or utilities, a tutorial, or simply what are the keywords to research this on Google.
sounds like you want logging for linux system resource consumption?
maybe you can write a script that periodically dumps top output... there probably are tools for this, but i agree it's hard to search for
yes. That's how I'd phrase it.
Definately improved the quality of my search results. So thanks so far 🙂
Have you looked at monitoring dashboards like Netdata?
You are looking for monitoring/observability/apm.
Most companies providing that as a server have some form of free tier (new relic has 100Gb free, datadog has 1 server with a short retention, etc.). Or you can install something open source like opensearch (with some metric shipping), collectd, prometheus...
Any laptop is fine.
Okay this might be the right place to ask this
I'm gonna drop my r/learnpython post which explains the error im getting and also the github repository of my script
hopefully someone can help me figure it out because it is really stumping me here
the repository:
the explaination:
if you can think of anything or have any questions please @ me, I have class for the next few hours but I'm free after that and would kill for an answer
I cannot change the brightness of my laptop screen in Ubuntu...
I could not find any solution to fix it
I got tired
Help me if you know about this problem...
It doesn't just work with the keyboard shortcut?
@lost grove you can use a less memory and cpu intensive distro, apt is slightly more stable and more appropriate in this case, running pacman or other package manager isn't a good distro choice and as for logging you can set limits for when to dumb log files, ex: if cpu percentage is more than 50 then touch file cpu.log and <report> or if memory more than 70 touch mem.log <report>
This will be much more effective then setting up cron jobs to accomplish this task and btw cron jobs are not the best way to achieve this, and as for optimization my personal choice would be to: 1. Less bloat (including: package manager, init system etc) get rid of systemd if you care about disk space and slightly more stable performance.
- Using crons the right way, set up monthly fstrim for ssds If yours supports its do maybe monthly reboots.