#unix
1 messages · Page 21 of 1
where are the databases saved created with the sqlite3 command in OS X
@simple phoenix well, if you didn't give it a filename during the command, it may have been in-memory only
i guess it creates it where you actually run the command?
you provide the db file path in every command
if i dont give it one its mem only ?
if you do not, then it is in-memory
I'm trying to make some command-line interfaces (using Bash) that I can chain together. For example, I want to be able to use a Bash script like so: getdata.py | processdata.py > out. getdata gets the data from an API endpoint, and processdata processes it into a more Python-friendly form, splitting strings into lists and "yes"/"no" into bools.
I'm wondering what the best way to handle passing along Python objects is. I need it to print it in a way that is human-readable, but easy to change back into Python. Security is not a huge concern, as this is a personal project, and I trust the endpoint.
Should I just print them to stdout and then call exec to convert the passed objects back to Python? Or is there a better way to do this?
@fading flint any reason they should be separate processes rather than chainable tasks within one python script that you can run in a pipeline fashion? either way if getdata is just grabbing JSON basically you can just pipe that directly into the next thing i suppose. do you need a script just to fetch the api data to begin with? is the API request complicated enough that it cant just be done on the command line with httpie or something
I mean, it's not terribly complicated. It's just paginated, so I want to get every page and get rid of anything that's not not in the "results" list. But once I have the data, I want to handle it in different ways, output it to a file/stdout or throw it to another script.
@fading flint cool, then sure, since it's already JSON data, may as well just send it to stdout if you want to be able to pipe it. better than pickling python-specific data and such
@main olive here probably suits more
ok
well then
its still on configure
I remember last time when trying to make -j4 there was some error about no package c_array or something
or _c_array
something with underscore and c at the beginning
make clean
./configure --enable-optimizations --with-ensurepip=install
make -j4
sudo make altinstall
ss if it pops up again but probably just a warning that can be ignored
yea j4 is just number of jobs not sure if you can/should go any higher
well Ill ping you when its done
@edgy minnow ok so it has finally done make -j4 just started sudo make altinstall
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
MakeFile:1140: recipe for 'altinstall' failed
make: *** [altinstall] Error 1
apt-get install libffi-dev & run that line again
@edgy minnow if I do pip it still says cannot import name main
yea sudo for apt stuff
rerun the make altinstall? get past that error?
no _ctypes error this time?
(dont want to say it but might need to make clean again)
h
does python3.7 work? python3.7 -m pip?
nop, I am going to just erase the sd card and reinstall everything from fresh
one last thing
ls -la /usr/bin | grep python
from a fresh raspberry pi zero, what are all the steps in order, are there any prerequisites i need to install, anything, can you list them in order?
probably the script there, updating to 3.7.2 and adding ensurepip
@main olive You might want to try using pyenv to install python: http://www.knight-of-pi.org/pyenv-for-python-version-management-on-raspbian-stretch/
The easiest way to install pyenv is: curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
@edgy minnow about this line of code
sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev -y
should I change anything?
i wouldn't, you can remove some of them after the compile/make is done
@edgy minnow lets say a new version comes out, how do I update python to the latest?
until its gets added to the repos, you'd recompile from source. you'll be fine sticking on 3.7.x though
do I need to uninstall the previous python version?
apt will take care of the installing
it'll update just like all your other programs do
how do I use it?
I thought the code I use is this
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
tar xf Python-3.7.0.tar.xz
cd Python-3.7.0
./configure
make -j 4
sudo make altinstall
since this is what I did, how would I uninstall it?
you would have to delete the files that make altinstall created
@edgy minnow so I finished installing python 3.7 now
if I do python 3.7 -V it shows the correct one, if I do pip3.7 it shows pip for 3.7, but if I try to do python3.7 -m pip3.7 install -U https://github.com/Rapptz/discord.py/archive/master.zip#egg=discord.py[voice]
it raises an error saying no module named pip3
ok what, it worked just a second ago, now its saying cannot import name main again
wait no
now its not again
this is stupid
hm now its working again
well anyways if I do pip3.7 install -U https://github.com/Rapptz/discord.py/archive/master.zip#egg=discord.py[voice] will that work
and do I do sudo?
(which line? do you add anything after it worked - a .py file?)
that line should & no dont sudo
well what if it says no permission
the [voice] may need some packages... what directory are you in? - you shouldnt need sudo & wouldnt blindly use it
should I be in the resource folder or the root?
@edgy minnow
resource, anywhere in home (~) would do
Hey @edgy minnow ir says permission denied
pip3.7 install --user -U httpps:...
did you notice you didn't have a git+
Also why are you installing it from source, just download it by pypi
You can't use async (master branch) with 3.7 btw
Looking for the android tools, like termux or .... there always seems to be lurkers here looking to find out best how to program on android. I only see things like windows and unix. It would be nice to see a android channel. Especially in setting up environments to use on android. I personally use pydroid and python but looking for something more ide like. Still very newbie-ish but working my way through ATBS book and solo learn. .... suggestions for us primary android users wanting computing tools? Please don't suggest laptop as there are many reasons why there is a group of us who can't/ don't have laptops, yet still eager to learn programing. Thanks! Move this topic if need be as I want sure where to put it.
may need more of the error there, probably just the stuff for [voice] needed, if you dont need voice/audio stuff just remove it
sudo apt-get install libnacl-dev may be the missing lib for voice
odd looking error @edgy minnow so I run my bot and it says inside of discord/compat.py that asyncio.async is invalid syntax
I did python3.7 filename.py
sounds like async error, that installed instead of rewrite?
pip3.7 show discord.py
@main olive
version is 0.16.0
yea thats async.
pip3.7 install -U git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py
@rewrite was missing in your one above
ah, so can I uninstall the previous one?
pip3.7 install --user -U git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py?
it should install over, yea
alright
only seems that way.... need [voice] stuff?
Can someone tell me what LVM "thin pools" are? I can't really find anything on it, but I may not be searching for the proper thing.
you mean thin provisioned lvm volumes? https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/logical_volume_manager_administration/thinprovisioned_volumes
looks like lvm supports allocating blocks on write/use, rather than on volume creation. this lets you make say two 150GB volumes on a 200 GB partition
and which ever one claims the space first gets it
why not just ask your question here so everybody somehow related to linux can help you
I'd be able to answer questions here, but I can't join VC, as I'm at work
I need some help
how do I get dirname followed by filenames.. for all the files in a given dir
what I have so far:
echo $(basename sourcedir path) will list the last dir name..
and
find dirpath -type -f .. lists everything in the directory but inclusive of source paths specified
how do I put these together.. or is there another way?
nevermind I got it..
lots of trial and error
for file in find dirpath -type f; do path="$(basename $(dirname $file))"; onlyfile="$(basename $file)"; fin="$path $onlyfile"; echo $fin; done
so this made like a list
if I wanted to pass the list to a separate script, I need to output it to a file.. with > then filename
but is there an another way to just pass the list generated from the first command as a argument to the script?
if you make your script read from stdin instead of reading command line args you can just use the pipe |
stdin/stdout are special files that you can easily connect together to make programs dump data between each other
@main olive maybe it's easier to make the script walk the directory tree on it's own
(what if you have files with spaces in their names?)
the thing is the script im using isn't mine.. it was made to use a file as an argument.. hmmm
how do I split a file based on the number of lines
when there are odd number of lines
never mind
got it
split -l numberoflinestosplitby filename fileyouwantsegmentstobenamedas
how do you run a command.. such that it follows right right the previous command has finished running
the two commands are not related to each other..
is anyone alive
how do I format my echo output, so if you copy to clipboard, you can paste in separate columns of a Sheet
nevermind..apparently that's not a thing
@tron use a semicolon to run two unrelated commands
@main olive you can tab delimit your data and usually paste it in to spreadsheets pretty nicely
anyone know how i can install python onto Debian without sudo access?
Debian should come with a version of Python 2 and 3 preinstalled, I think
or do you need another, specific version?
I don't think I have pip
Comes with python 3.5.3
Would like to see if I could get up to 3.6 as well so I can use fstrings
without sudo, pyenv comes to my mind which compiles any Python version you want on your machine, locally for your user only
Check out the readme there to see if this is for you
You can then easily install it with https://github.com/pyenv/pyenv-installer (tl;dr: curl https://pyenv.run | bash - note: this downloads a shell script and executes it, you should generally not blindly run this but verify first that what you get is valid and not malicious)
PATH is an environment variable that contains a list of directories where the system shall search for executables when you type a command.
thanks
thank you @ riffautae.. didn't want to disturb you .. so didn't tag
@oak shell so can I set that to as example the neofetch folder?
You should never replace the value of PATH, only append your additional directories to it, separated with a colon (:)
like PATH="$PATH:/some/absolute/path"
otherwise nothing will work any more if you replace it
So I just add neofetch to the path?
the folder where it is in
so if the executable is /home/raizo/something/bin/neofetch you would append this line to your user's ~/.profile:
PATH="$PATH:$HOME/something/bin"
then source ~/.profile or close and reopen your terminal
Uh what do I do to add it ?
in /etc/ there is a sudoers file but that seems pretty complicated
no experience with android, really
Thats.. iOS
well, neither
I would assume you have to add your own user to the sudo group
on e.g. Ubuntu that would be as simple as running sudo adduser mobile sudo from any account that is allowed to use sudo (or root)
Nice!
Gracias!!!
Can I get help I clicked hide menu. How do I fix that... I am on mint 18.
Know what.. that was easy to fix..
Can someone please tell me whats the use of the ex text editor or rather ex version of the vim editor?
don't understood your question @brittle scroll
what answer you expect to hear?
please explain/expand question
You mean the mode you enter when entering Q?
Here's a SO answer detailing why it's useful in some use cases: https://vi.stackexchange.com/a/2692
@arctic olive i need to write an article on ex command but i am confused what to write. I read before vim ex, ed was used. But my question is what is the use of it now?
@cold pagoda thanks.. im checking it.
@cold pagoda i dont even what "entering Q means" except :q is used to exit vim -_-"
there is wiki page about ex editor, which explain it
honestly, i'm not a fun of vim, emacs or cli based editors. I walked a long way from working in emacs cli, then wingIde, and then using vscode just as simple text editor
I mostly use editors from jetbrains.. I have no experience whatsoever on these xD But somehow i have to write an article on ex : [
@arctic olive can you please share the link of that wiki page.
Have you tried using python3 in the terminal? It may have Python 3.6 or similar installed already
Also would it be considered safe to remove python 2.7.5 on XFCE?
i mean it aint 'Kali'
or any other Pentesting distro
I am about to do that
I wouldn't do that, if I were you. Just leave it and use another version
You can set up an alias for your terminal sessions in your profile file
how'd I launch one using python3
say I got a .py file that I wanna run
python36 Program.py?
Well, I use python3 (which is Python3.6 on my system), python3.7 for Python 3.7, and python for Python 2.7.x
if you put #!python3.6 or #!python3 at the top of the file, the py.exe launcher will detect that on windows
and run the appropriate version if installed
how can I check if I got python 3 or any other version tbh
I did python -V in terminal
Anyone know the command to check which binary is executed for a command
what OS?
oh, this is a unix channel, i'm a dumbass
type will also return if it's a shell function or builtin, which or type -P (bash-specific) will search exclusively for binaries
zsh has a whence command with various options
note that which will not tell you if you have an alias, shell function, or built in, it only looks for binaries
Oh wow zsh looks very complicated
Is it possible to enable a built in WiFi card or a USB WiFi dongle via Ubuntu Server command line? If so, how? Everything I’ve tried hasn’t worked
You'll need to find the interface name with ip link
Then ip link set <interface> up
Ty
Anyone here who can help me with a shell script ?
!t ask
Asking good questions will yield a much higher chance of a quick response:
• Don't ask to ask your question, just go ahead and tell us your problem.
• Try to solve the problem on your own first, we're not going to write code for you.
• Show us the code you've tried and any errors or unexpected results it's giving
• Keep your patience while we're helping you.
You can find a much more detailed explanation on our website.
I am using homebridge to execute a file
It prints out what it is supposed to and creates the file but if I am outside of the directory the on/off.sh is in it just prints out "ON/OFF" but doesnt create a file
echo "ON"
echo "This is flag Switch ON" > ~/script.flag
echo "OFF"
rm ~/script.flag
we are gunna need a bit more code to understand this, or maybe a description of which homebridge you are using
Can I just send you the reddit link ?
sudo is about executing files, not seeing them
so really you should just make sure the user has proper read / execute access on the file system
I did
what are the permissions of your on.sh files and of the domizimmer folder
including the owner/group
and then what user is running the script when it fails
the user running the script is homebridge
it is executable by everyone
i did it with chmod +x
what are the perms of the folder its in?
where are you expecting to see the flag?
ah yeah also that will make the flag in your home directory
~/script.flag ~ means home directory
I tried it inside the directory and it worked just fine
were you running as the homebridge user?
my problem is if i am using it like sudo /var/domizimmer/on.sh
it doesnt create the fil e
sudo runs it as root, so with your code that puts it in /root/script.flag
if you run it as your user name, it puts it in /home/yourusername/script.flag
doesnt matter what your current directory is, you used ~ which means home directory
you can double check with env | grep HOME but yea user/root will have a different home location
yeah that makes that make more sense
so
thet issue is that . is current directory
in the first screenshot the current directory is /var/homebridge/domizimmer
in the second one its /home/homebridge
ohh
so its putting the file in your home dir when you run it hte second way
you should use the full absolute path
alright i will try that
so now it works creating the file
and setting the "switch" on and off after executing the file after typing it into the terminal
but it doesnt create anything if i use homekit itself
{
"accessory": "Script2",
"name": "Domi Zimmer",
"on": "sudo /var/domizimmer/on.sh",
"off": "sudo /var/domizimmer/off.sh",
"fileState": "/var/domizimmer/script.flag",
"on_value": "true"
}
Do you have any Idea what is going wrong there too ?
remove the sudo's?
I tried but it doesnt fix it
"accessories": [ { "accessory": "Script2", "name": "RPC3 Socket 1", "on": "/var/homebridge/rpc3control/on.sh 1", "off": "/var/homebridge/rpc3control/off.sh 1", "state": "/var/homebridge/rpc3control/state.sh 1", "fileState": "/var/homebridge/rpc3control/script1.flag", "on_value" : "true" } ]```
just the docs example, on_value not needed... not sure what those 1s are doing (probs just args), scripts are all executable...
also you never did post the permissions of the folder /var/domizimmer/
how do i do that
I must have overread that
ls -l /var/ | grep domizimmer
this should output JUST the permissions for that one folder
drwxr-xr-x 2 root root 4096 Feb 6 04:27 domizimmer
ok so thats prob the issue
well it has +r and +x so hm
you can log in as the homewhatever user if you want using su -u otherusername
and then try running scripts and browsing the file system to make sure you can see all the files as that user
i can
i am able to everything
but if I want to execute that script i still need sudo infront of it
should I set the permissions so that everyone is able to execute everything
thats a good way to really mess up your system imo.
i would remove sudo from those calls
oh i know the issue
its sudo
by default i bet its making files owned by root and readable ONLY by root
you need to run those scripts as your services user
and change domizimmer to be owned by that same user
ideally you would move those scripts out of the folder, but this is still more secure then giving everyone access to everything
but basically if you create a file as root, which you are since you are using sudo on a script that makes a file
its prob defaulting to not let anyone else read the file
:>
You don't know how long I tried to fix that issue
I got everything else working
The script to use the GPIOs e v e r y t h i n g
Thank you 😃
your welcome
@vague glacier how did you try to update it
if you are on 14.04lts it won't go higher than 3.4
I think it installed
@vestal turret ill be back in a few hours because college but if u can help then itll be appreciated
@vague glacier because sqlite is part of the Python standard library?
You need to pay attention to things like this before you install something malicious
For the record, as far as I can tell the actual sqlite3 module is maintained outside of python and available on pypi... as pysqlite3.
I use it for db.browser
AIUI it's mainly available for if you need to build it against a different version of sqlite3
the point is, python ships with the sqlite3 module as part of the standard library.
so you shouldn't need to pip anything except under special circumstances
Yeah I used pip for downloading discord module but thats pretty much all i need
Thank you both of you ❤
😦
thought downloading wouldve fixed this
run it using python, not bash
you need #!/usr/bin/python3 or whatever at the top
Don't use that shebang
Use #! /usr/bin/env python3
That should ensure the correct Python
Ok, ill try that
the most robust way, technically, is to make a separate shell script that just runs python3 file.py "$@"
!
from here would i run through that?
as thats ovo the shell
And I would like it to be one file currently, can update later 😃
@tawny sky i used the method you said but now im stuck at this part, dont know how to actually run it from shell
you don't run it from that
that's a repl
it's python filename.py
you can exit() that repl
It says it doesnt exsist?
you're gonna have to be more specific than that
I think you've had just about enough messing around for now :P
You need to go take a python basics course or tutorial
and perhaps a bash one as well
Its not my python knowledge per say,
I just havent touched outside of it
Aka linux or virmach or os etc
I mean, you're clearly missing a few parts of both
the repl is a pretty basic piece of python knowledge
additionally, I have no idea why you're even using bash for windows for this
windows is just fine for Python development
I've never heard of virmach but it looks like your usual cheap server host
plus windows support
anyway
you don't run python differently on linux
it's the same command
because it's still called python
the only thing you need to worry about is making it run all the time
at that point I usually suggest writing a little systemd unit, but of course you'll need to learn how to do that
many people will tell you to use screen
do not do that
many other people will tell you to use nohup
don't do that either
yeah ive been told to do that lmao
every linux OS provides some way of managing applications that should be running in the background all the time
today's most common init system, as they're known, is systemd
I think what @tawny sky meant was to not run the script manually in the terminal; detach it and leave it running (which also includes tmux) , but to run it as an explicit background process through systemd
is anybody here who can help me with a simple tkinter problem?
just ask, but it might fit better into e.g. #user-interfaces or a regular help channel, unless it's specific to Unix/Linux platforms
weird query, not sure if devops or unix really
the other day i had an issue with an EC2 where i'd mounted an extra bit of storage
60gb worth
but it was behaving like it was full despite there being 25gb free
3 million sessions being stored in text probably didn't help but it was still a weird thing
all diagnostics pointed to it being a 60gb drive with 25gb free
but it just would not write
answers on a postcard <3
@quaint mirage if you had tons of small files on there, might you have exhausted the file system's available number of inodes? Check df -ih for inode stats.
My 50gb ext4 partition has roughly 3M inodes available, so if each of those "sessions" is a single textfile, that could very well be full
to change the number of available inodes, you'd have to reformat the partition and specify that as argument. https://unix.stackexchange.com/q/26598/103151
we were migrating the site away from that server and out of our hands specifically because it was configured and developed on by an absolute monster. he was going into magento's core code and fucking with shit, set it to store sessions as files rather than in a database, etc, etc
so everytime a problem happened it was either like... a legit magento problem or a cluster fuck because he'd messed with core code
yikes
🙀
so I had a dream tonight...
that I went to my new job as developer...
and they asked me during all day to do tech support and maintenance
because there were nothing to code
a) how does that relate to unix and friends
b) that is usually not going to happen
c) even if it does its not that bad
@sage solar why not call yourself uNix?
can someone help me out with Kerberos auth on linux.
i am doing a request.get(url), and it returns a 401 with "Negotiate"
what do you want to know?
i've used it a bit in the past, but i'm not an expert
@autumn dune
as in; it does not apply the layout?
and if you run the command normally (in the terminal) it works?
then the error might be with your command
i don't quite understand how this:
setxkbmap -option 'grp:alt_shift_toggle' -layout us,de,rs -variant ,qwerty,latinyz
closes the terminal, are you sure it is supposed to look like this?
especially the leading comma in the variants
in your i3-config you need the exec
have you bound that to a key or do you load it at startup?
👌
i3 wm was nice pleasure for me for years on desktop pc
but since I've moved to laptop notebook i miss quick access in tray to bluetooth, wi-fi networks, etc, & stuff
so i'm looking forward to setup window tiling for full blown DE (gnome, kde, unity)
and enjoy benefits of both worlds
@arctic olive there's Manjaro KDE Linux
It's a easy to install, and is roughly based on arch
It's what I'm going to use on my notebook
i've tried Kubuntu iso, but it wasn't even able to boot up : D
fortunately regular ubuntu iso worked fine
do you like to pull all those dependencies with rolling release updates?
why not LTS?
@gritty stirrup
I think being able to control dependencies is important
yes. but it's impossible to control them at Arch. you just want to install deadbeef, but you are required to pacman -Syu and might end up updating kernel & glibc
not so comfy way of getting deadbeef installed. Right?
@arctic olive I said Manjaro is based off of arch, i don't have a whole lot of experience with the dependencies management. If I find anything I'll post it back here?
sure
you aren't required to -Syu, the u makes it upgrade everything, you can omit it
the user might not required to -u but afaik official Arch guideline highly suggest it before the installation of package. because some times package binary might have dynamic linked dependency to another package which was not stated/mentioned/declared at PKGBUILD. and -Syu helps solve similar cases.
anyway, if user still doesn't use -u, packman -Sy with installation/upgrade of particular package still might drag explicit dependencies that may upgrade your OS and affect other packages.
cuz you may let's say install package_A, with pacman -Sy , (without -u), which may upgrade your glibc. but you may also have in system package_B from AUR what has dependency on older version of glibc.
and package_B has not been upgraded - because you did not invoked -Syu
yea
I used: yum provides */libssl.so
give me a lot of things
but when i used install
yeah, openssl-devel is the correct package according to the internet
he say that i already have installed
so the other issue is that your compiler is not finding that library
It could be that the python you're compiling is too old and not intended for use against the openssl fedora provides
The problem is that here in work, i have to use a specific version of python to run a project
and the libraries that project use it's used by python 3.5.0
Well, the version it's not the specific problem.
I just need a version that match with the librarys]
i try with 3.7 but don't find the last five librarys
I don't try with 3.5.6 because he came without pip
There's a way to install pip from a virtualenv how came without pip?
that won't help you
you want 3.5.6?: wait
If python 3.5.6 find the librarys, that's works fine
I don't tried yet
well what have you tried
No, that's not what I asked you
and fail
If you want, i can send you the requirements
i tried with 3.5.0
I mean regardless I have to go to the bathroom
but don't do anything too rash yet
give me time to check this out
I can confirm that python 3.5.6 with pyenv on Arch Linux installs correctly and that pip works
now brb
Well... i think fedora doesn't like me
Installing Python-3.5.0... WARNING: The Python readline extension was not compiled. Missing the GNU readline lib? ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?
Ignoring ensurepip failure: pip 7.1.2 requires SSL/TLS
I'm beginning to think the same
Do yourself a favour though, don't move to arch
Use antergos or manjaro
They're based on arch but much easier to install
The problem is not the difficulty of the installing things in the distro. But here im work i have to give the solutions as fastest as i can. So this bureaucracy to make some things are really bad.
It sucks, I'm with you
But you will have to spend a couple hours setting arch up if you install it directly
Which I think you don't want
auehauehas
It may still be possible to salvage this on Fedora
But it's outside my area of expertise
Maybe if i install python 3.5 with make install work?
I don't think it will since it seems to think you don't have ssl
You are running the configure script, right?
yea
No, everyone here uses windows.
I am an army of a person. Doing it all alone.
Right, okay
Well personally I would install arch or one of the other two distros I mentioned
Install pyenv and get it that way
I will try ubuntu.
But I don't really know fedora, so
auehauehauehs
I tried because it's already installed here in the PC. So i think i could try to learn, but this is too much work for some little things.
Yeah, I think you'd be better off with arch
Ubuntu is quite unfriendly for a developer to work with too
why?
Old packages mostly
Everyone talk so good about him
And apt likes to get stuck in dependency hell
I like arch personally because once it's set up, it's very easy to maintain
There's no worrying about being out of date or needing to think about old versions of packages being incompatible, it just works
Yeah, so use manjaro or antergos
Which will set things up for you
They're still arch, but they have an installer
Maybe windows it's a better options.
The installer will partition for you and set up the graphical environment for you
After that you just need to install pyenv and your IDE
You have sure?
I use arch daily, it's what I use on all my machines
If you get stuck, you can ask me or one of the many arch users on this server
Well, install arch is a radical option. I will keeping searching for a solution.
Okay
@tawny sky: Works now
aha, good call
I just had a deja vu now.
Ah? :P
What do you mean by the past?
Ah, pyenv isn't a replacement for venv
Run pyenv init
That'll help you set up your shell
Anywhere
Then you can do pyenv shell <version>
And it'll switch to that version in your shell
oh
that's what i want
i guess
when i use pyenv shell <version> we will set me to the enviroment for my package?
It will set the environment for your shell
so python and pip will be the correct versions
No problem
It's a proble to move my pyversion for another folder?
there's a problem with finding the path?
i have a django prpject in my /www/
so i like to put the pyvenv in this directory
You can set up virtualenvs like you normally do if you want them
I mean, they're not the same thing :P
pyenv exists so that you can install multiple versions of python to your environment without root
it will not isolate the packages between projects, so you still need virtualenvs for that
ohhh
When i create a pyvenv version. I still need to use virtualenv for set my enviroment?
You should still make a virtualenv, yeah
Just do it like you always do
After you set the version you want with pyenv
but this version of pyenv it's in my global now
`
[pedro@localhost ~]$ python
Python 3.5.0 (default, Feb 13 2019, 10:07:50)
[GCC 8.2.1 20181215 (Red Hat 8.2.1-6)] on linux
Type "help", "copyright", "credits" or "license" for more information.
`
Great, so all you need to do is make your virtualenv
But if i want to set a diferent python version?
use the pyenv commands to change the version, then make your virtualenv
the virtualenv will be locked to whatever version you were using at the time
i will read the guide. Thank you for all <#
No worries
@tawny sky: Hey
Hey
you know what package is this?
No matching distribution found for pkg-resources==0.0.0 (from -r requirements.txt (line 19))
what the
this even existis?
why 0.0.0
that's what i'm thinking
one second
pkg_resources is actually part of setuptools
it shouldn't even be in the requirements file
remove it I guess, see if it still works
It doesn't exist on pypi so there's no way you could install it that way
there's a flag for skip it?
well, give me a lot of erros.
I upgrade pip version and work's now
only give me this erro: djangorestframework-filters 0.10.2.post0 has requirement django-filter~=1.0, but you'll have django-filter 2.0.0 which is incompatible.
But i expected that's not a problem
That looks alright, I guess
It might break things
It basically seems you're working with real old software
the end result of doing that means some versions you're using may no longer exist
you'll have to work with what you have
Well, that's cute. But if i 'might break things' i will be fired
I mean, it's hardly your fault is it
Software that's been unmaintained for so long that the libraries it depends on don't exist anymore? that's not your fault, you inherited it
Tell that to my boss..
If they fire you for that, they're probably a bad employer :P
can't help atm, but I've also not worked with polybar before. My best guess is looking at the docs 🤷
@autumn dune have you checked polybar docs? it has pretty good configuration documentation
slowly remove stuff from your current config one by one until the margin disappears 😛
mine is only 225 lines, how long is yours?
tfw comparing lengths
but most of the regualr stuff are at the top, and there aren't a lot
Errpr: Package: python-libs-2.6.6-66.el6_8.x86_64 (@anaconda-CentOS-201703281317.x86_64/6.9)
Requires: libdb-4.7.so()(64bit)
Removing: db4-4.7.25-22.el6.x86_64 (@anaconda-CentOS-201703281317.x86_64/6.9)
libdb-4.7.so()(64bit)
Obsoleted By: libdb4-4.8.30-13.el7.x86_64 (epel)
Not found
``` I got something like this, how can i resolve this?
Hi
I'm going to be getting a new laptop. and i will be using some form of linux.
Being a windows dev for so many years means I am very comfortable with it, but I want to try something new.
I am really looking for a distro recommendation - Preferably something easy - But a but more than ubuntu.
Simplicity of distro is important, and also being able to make a nice terminal would be great ;D
you can make a nice terminal on every distro
to a certain degree
there are some implementation details which are different but its mostly gonna work
and you still can just do bash script.sh in a zsh
Ok thats fine
@sage solar Can I pretty much copy my windows desktop in things like manjaro linux?
Manjaro looks like the right distro for me
But there's so many options
KDE, GNOME, XFCE
I3
i mean there are certain DEs which aim to imitate windows
but tbh the basic functionality should be pretty equal and its not that hard to get used to other DEs
@sage solar I don't think I need i3 to get a simple desktop like that
So that narrows it down to either GNOME or KDE
What is the differences I should care about?
personal preference?
depends on the script, technically, but probably
you could also just still run the script with bash, and just use zsh for your interactive shell
oh i was scrolled up
everything must be done in assembly
lol.. XD
-R is short for --dereference-recursive
not sure what the 1 is
maybe it's treated as an operand?
I didn't think so
options can be chained that way, so it wouldn't make sense for it to be an operand
This seems more likely to be it: ```
-C num
-num
--context=num
Print num lines of leading and trailing output context.
No, like I said. It isn't an operand after all
The only option I found is the context one
it's the second alternative, -num
you don't type num, rather you put the actual number of lines to output
e.g. -1
and options can be combined, so -R1 instead of -R -1
That's the way I understand it. But I am not speaking from experience as I've never used either of these options before with grep
it's 1
ahhhh
that's probably it Mark
is there a way to preserve capture groups in sed
!echo '(snorlax "(1: words here) yes?"' | sed -E -r "/(snorlax/ s/([0-9]:) /:/g"
I check if the sentence has snorlax in it.. then remove the space after (n: where n is any number..
but its not working..
maybe sed isn't right for this?
what is the -e for in sed..
ahhh
that explains so much
is there a way to use a wildcard in a path being grep'd?
like..consider
!grep -l '([0-9]: ' 'home/dir/mac/info/' -R1
can I do
!grep -l '([0-9]: ' 'home/dir/*/info/' -R1
so it's any directory that has those same subfolder/subdirectories
I don't know if grep supports globs for directory operands
Maybe you'll need to resort to using find first
find?
I thought find can only be used for.. searching in filenames
oh..you mean.. a Find before Grep.. to find partial patterns?
in the filepath?
I'm not sure what you're trying to do
but maybe the -exec option of find will work for you
(you would use grep in the exec)
So this is my shell noobness showing, but wildcards are actually expanded by the shell not by individual tools
it wasn't a matter of grep not supporting it, so find would not be needed
rather, the wildcard just isn't expanded by the shell because you have quoted it
🤔
Hey, guys. I'm using ssh to connect to my server and i want to transfer a folder from the server for my pc
I have to use the scp like this?: scp <folder form my server> <myhost>@<myip>?
https://linux.die.net/man/1/scp
scp -r <folder from your server> <yourusername>@<your hostname/ip>:/where/to/put/it
scp copies files between hosts on a network. It uses ssh(1) for data transfer, and uses the same authentication and provides the same security as ssh(1). ...
@ornate gyro : There is a problem. Here where i work we use a proxy connection, and everyone have the same IP. So i'm afraid to try this with the ip and the file go to another pc
@main olive If you're using ssh already, you can use sftp
@tawny sky : no
I try to make a scp for my own machine and got a connection refused, like what
@main olive What do you mean, no
I said sftp, not scp
:P
If you have an SSH client, you likely also already have SFTP
considering it also operates over SSH
but i don't want to use sftp
And why not?
I'm trying to send a folder to the server for my pc
yes, you can use sftp for that too
and getting a erro:
FATAL: failed to begin relaying via HTTP.
ssh_exchange_identification: Connection closed by remote host
lost connection
I just want to use a simple scp
you're using some kind of HTTP proxy?
I mean, I know exactly nothing about scp, I would personally use sftp for this
Actually, work when i transfer a folder from my pc to the server
but from server to my pc aren't working
Well, you can't just connect to your PC from the server
You'll need to connect to the server and then pull the files you need

I connect to the server via ssh
and trying to transfer the file from it
@tawny sky: I try with sudo ssh, and i get this:
ssh: connect to host <ip> port 22: No route to host
lost connection
Hey, @tawny sky . Can you help me using sftp?
@main olive scp user@remote:/etc/passwd /home/llun
What's everyone's favourite Linux terminal emulator?
gnome-terminal does the job for me
I've been looking into arch/Manjaro Alot recently, and I'm confused by the whole "partitioning" thing. Mostly around the idea of deleting /
When I installed Manjaro, I just told it to "erase" all the old data. Is this fine? Or should I care about the swap etc partitions
@main olive do you have same issue still than restart your rooter and pc
/ being root
If you’re using a graphical installer and you don’t care much about the data that’s currently on your disk, letting it wipe it gets rid of all the partitions too
Why do people decide "Hey for the graphical installer we are going to manually make all the partitions because I'm cool!!!!"
I want to use my own intelligence, but I see stuff like that and wonder what the hell is the right thing
The guy booted into Manjaro, opened a terminal and manually deleted root
what? who? how?
I wrote a shell script to run my bot but I am getting ModuleNotFoundError: No module named 'discord' error. I am able to run the bot directly but not through this shell script. I am posting the script below:
#!/bin/sh
# launcher.sh
# navigate to home directory, then to this directory, then execute python script, then back home
cd /
cd home/pi/server/fortknight_bot #where the script is
sudo python3.7 bot.py #a commnad to run the script
cd /
The problem is you don't have discord Py installed
Not related to your shell script at all
Then how is it running otherwise
I mean if I run it directly python3.7 bot.py it runs
Presumably because you just installed discord Py for your user but are running with sudo so under the root user
👍
So python generally installs for the current user only?
I compiled this version
pip install --user module (unsurprisingly) just installs for the current user
LOL I thought you were talking about python
Now I understand it clearly
Thanks
✌
@sage solar You know how to setup a cron job for this shell script?
To run at every restart
I'd just write some systemd service
^would also work
● launchbot.service - Fortknight starter service
Loaded: loaded (/etc/systemd/system/launchbot.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Fri 2019-02-15 19:02:21 IST; 4min 34s ago
Process: 335 ExecStart=/home/pi/server/fortknight_bot/launch.sh (code=exited, status=0/SUCCESS)
Main PID: 335 (code=exited, status=0/SUCCESS)
Feb 15 19:02:20 raspberrypi_SERVER systemd[1]: Started Fortknight starter service.
Feb 15 19:02:21 raspberrypi_SERVER launch.sh[335]: Traceback (most recent call last):
Feb 15 19:02:21 raspberrypi_SERVER launch.sh[335]: File "bot.py", line 1, in <module>
Feb 15 19:02:21 raspberrypi_SERVER launch.sh[335]: import discord
Feb 15 19:02:21 raspberrypi_SERVER launch.sh[335]: ModuleNotFoundError: No module named 'discord'
Added a service but got the ModuleNotFoundError
Should I reinstall the module for all users
what you should actually do is use a virtualenv or pipenv or poetry for project depedency management so this stuff doesnt bother you anymore but yes installing for all users would probably fix the issue
Yep installed it for all users...
Still the same error
Also tried venv
cd /
cd /home/pi/server/fortknight_bot #where the script is
source ./env/bin/activate #activate venv
python3.7 bot.py #a commnad to run the script
cd /
Okay I found a way around this problem
I used .bashrc file to run my script at startup
So if anyone needs an easy way to setup their bot to autorun at system boot, here one way to do it:
Create a bash (.sh) script which will contain the command to run the python file for e.g.:
Contents of launcher.sh:
#!/bin/sh
launcher.sh
navigate to home directory, then to this directory, then execute python script, then back home
cd /
cd /home/pi/server/fortknight_bot #where the script is
python3.7 bot.py #a commnad to run the script
cd /
Now edit your .bashrc file using nano or any other text editor of your choice:
sudo nano /home/pi/.bashrc
And add the following line at the EOF:
bash /home/pi/path/to/launcher.sh -b &
wont that run the program every time you open a bash shell eg via ssh or a graphical terminal?
you probably want to have that, like Nix said, as a systemd service
or .xinitrc or .xprofile
Where do I find the folder where a program is installed?
Or, where does yay install its programs?
@gritty stirrup packages work a little differently on arch
when you install a package from the repos you actually install a tar.gz with folders such as usr and bin
so it's up to the packages where it has it's files placed
you can ask yay who owns a file though and also ask for the list of files owned by a package
yay -Fl package or yay -Fo file
to query package contents
to query file ownership
@rustic sky usr/share is useful
if you're just looking for the executable, which is really useful
although it often points to a symbolic link
Folks with macs running Sierra, are you able to install the pattern package for Python?
Mine gets stuck at this error Command "python setup.py egg_info" failed with error code 1
i have mac high sierra, close enough?
How can i download python3.7.2 on debian ?
if you cant get pyenv to work, and you cant create a non root user, just extract python to a location like /opt/python and then manually type /opt/python/bin/python or something when you run your scripts
i recommend trying to create a non root user however and use pyenv from that user
if you need a specific application to use this python, update the PATH environmental variable just for this specific program to have that python's bin directory at the front
eg if it has a startup script you can put
export PATH```
@haughty wasp if you're on testing, python 3.7.2 is already in the repository - apt-get install python3
if you're not on testing, this tutorial on compiling it from source isn't bad. https://tecadmin.net/install-python-3-7-on-ubuntu-linuxmint/
How to Install Python 3.7.2 on Ubuntu & LinuxMint. Step by Step instructions to install Python 3.7 on Ubuntu, Debian, and LinuxMint Systems.
thats what caused the original issue
they replaced the default python
i recommend never using make install when you have access to packages
ah they have make altinstall , interesting
guess that just adds python3.7.whatever as an option
i still consider that risky if you are not super familiar with linux
I'll be wary recommending this link then
@haughty wasp The easiest way to install Pythons not in package manager repositories is to use pyenv
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
exec "$SHELL"
pyenv install 3.7.2
Also, 3.7 was recently added to Ubuntu, but I don't know if that was the Debian or Ubuntu repositories: sudo apt install python3.7
Omg my life is saved
Thank y'all
And now, how can i set the default python3 command to python 3.7.2 ?
You could probably add an alias rather safely, as that should only effect your interactive shell. I'd still prefer giving it a different name and not having the real command shadowed. Add something like this to your ~/.bash_aliases or ~/.bashrc
alias py='python3.7'
@haughty wasp usually /usr/bin/python is actually just a symlink to the versioned binary, like so:
ryan@charlie:~$ ls -alF /usr/bin/python
lrwxrwxrwx 1 root root 9 Apr 16 2018 /usr/bin/python -> python2.7*
so you can just reset this symlink (as root: rm /usr/bin/python && ln -s /usr/bin/python3.7 /usr/bin/python) to reset python for everyone on the system, too.
But with pyenv, the python versions are not installed in /usr/bin/ But i dunno where lul
@haughty wasp oh yeah sorry, I hadn't seen that you were using pyenv and I'm not familiar with it so I'm afraid I can't help much there
I think i found something but i don't know if it's the good file
@haughty wasp yup that looks suspiciously (based on the size and its location) like what you're looking for!
I'll try x)
So i have to do rm /usr/bin/python3 && ln -s /.pyenv/version/3.7.2/bin/python3.7 /usr/bin/python3 ?
🤔
but i have to execute a file created with python 3.7.2 and i just have python 3.5.3 on debian 9
@haughty wasp can you not just directly execute the file via the 3.7.2 binary?
@haughty wasp /root/.pyenv/versions/3.7.2/bin/python3.7 /path/to/your/script
@boreal viper anb @vestal turret Thank both verymuch, it works :D But i have a strange error
The file infos.json exists
@haughty wasp you're very welcome, glad to hear it!
@haughty wasp that open() call is looking for a file in a relative path (files/infos.json): are you running this in the folder that has the files/ folder within it?
Try replacing files/infos.json with the absolute path
or what @vestal turret said 😃
(that's probably a better idea anyway, or better still make that file's path a command-line argument!)
Why when i try to run pip, it's says me```pyenv: pip3: command not found
The `pip3' command exists in these Python versions:
3.7.2
use /path/to/python/3.7 -m pip
this will make sure you are using the pip associated with that binary
oh god... I forget that python 3.7 has problem with asyncio ;-;
Let's install python 3.6 ! ;_;
You could always still replace the f-strings with .format() or % formatting and use the system binary
how do I count total lines in all the files in a directory using grep
I know I can do.. for a single file
grep -r "some string" . | wc -l
find directorypath -type f -name "*.php" | grep -r "instance" . | wc -l
doesnt help
every line in all the files in a directory?
@main olive
find . -type f -exec wc -l {} +
for specific files
find . -name '*.py' -exec wc -l {} +
not sure how to use grep to do so tho
I did something like
grep 'string sequence' dirpath/*.py | wc -l
not sure why my find didnt work..
wat
wut
if you need just to count the lines matching an expression, use grep --count
find . -name '*.py' -exec grep -c hunter2 {} \;
I have a question. Deja dup can't backup if you aren't logged in
Does screen lock count as being logged out? or would deja dup work despite the screen lock?
unable to create file '/run/user/1000/dconf/user': Permission denied. dconf will not work properly im getting this error when creating a file, using sudo io.elementary.code doesnt show any errors.
Check the file permissions and owner of the file
what does -c opt do
and opt?
What do you mean by that one?
I dont know.. lol its why I asked
I'll find the rest of the code.. where this was used
they passed -c opt
opt would be the command in that case
something like this
bazel build --config=opt --output_filter='^//tensorflow' //tensorflow/tools/pip_package:build_pip_package
Oh, it's not python 😅
they're building dependencies here.. for python
These options are for that specific program, I thought you mean the -c for the python program.
ahhhh
-c opt is to build with optimization enabled, debug information disabled.
I thought it was something common for all unix environments.. sorta like xargs :v
oki
any reason a cronjob set to trigger every minute wouldn't go off for an extended period of time (2h+) and then start working again when i log in 
did you use the system crontab or your user crontab?
user
but now that i think about it it may be possible that it did run and the thing it checked for (whether any python processes were running) was valid but for whatever reason my script wasn't working properly since my load averages were very low
can someone tell me why it shows this zos-remote.conf file when it should with that command only show files which start with a ?
It did.
There is /etc/arch-release and /etc/atmsigd.conf at the top. Those are the files a* matches. (or [a]*, same thing)
Additionally, this also matches some directories starting with a, namely /etc/audisp/ and /etc/audit/ too.
If you give ls an argument that is a directory, it will by default list the contents of that directory and not the directory itself though
Try ls -d if you don't want to expand directories but show those as folders instead.
@smoky rose
awesome, thanks for help
yo, kinda different to the usual questions here probably, but how can I get a second monitor to copy my first one in Linux (Ubuntu LTS)
with the terminal you can do xrandr --output otherdisplay --same-as mainscreen
but the display settings prob has an option for it
anyone ever use the subprocess module to call various networking tools such as iptables, ip route, etc. in a loop and have issues with subsequent runs?
i've got an automation tool that essentially runs a sequence of iptable/arp/ip route calls by calling subprocess.call() or subprocess.Popen() for the commands, but if it's run more than once without shutting down the instance of Python in between, then the subsequent runs seem to hang on trying to get it all configured
.call should wait for the commands to finish, but have you tried adding a small delay between the calls anyway? Maybe they still do something in background after they return, no idea.
Just sleep a second between the calls and see if that works, to rule any timing issues out.
@oak shell I will try that, thanks
is there any possibility to surpress this warning? it is not classified as an erroor
objc[8502]: Class FIFinderSyncExtensionHost is implemented in both /System/Library/PrivateFrameworks/FinderKit.framework/Versions/A/FinderKit (0x7fff911a5b68) and /System/Library/PrivateFrameworks/FileProvider.framework/OverrideBundles/FinderSyncCollaborationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOverride (0x11dcdecd8). One of the two will be used. Which one is undefined.
path = ""
while not (os.path.exists(path)):
path = input("Enter the path where the files should be saved. If you need help, type \"help\". ")
if path == "help":
tkinter.Tk().withdraw()
data["path"] = filedialog.askdirectory()
does anyone know a good and reliable way to play a sound on unix ? I've found some bits and pieces of info around, but the only good solution I found was windows only. I saw a solution that uses GStreamer on *nix but it only plays the sound, no info on the amount of time elapsed, pause/unpause functionnality or even stopping the sound
@mighty epoch are you looking to play a small notification type sound, or a music player?
more like music player @tender thicket