#unix

1 messages · Page 21 of 1

spring brook
#

If this function is not called then the library uses the function ctypes.util.find_library and then loads that one if available.
just saw that, let's see if it works when opus was built from source

simple phoenix
#

where are the databases saved created with the sqlite3 command in OS X

onyx apex
#

@simple phoenix well, if you didn't give it a filename during the command, it may have been in-memory only

simple phoenix
#

i guess it creates it where you actually run the command?

onyx apex
#

you provide the db file path in every command

simple phoenix
#

thinkautism if i dont give it one its mem only ?

onyx apex
#

if you do not, then it is in-memory

fading flint
#

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?

onyx apex
#

@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

fading flint
#

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.

onyx apex
#

@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

edgy minnow
#

@main olive here probably suits more

main olive
#

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

edgy minnow
#

ss if it pops up again but probably just a warning that can be ignored

main olive
#

its make -j4 now?

#

well this part took forever last time

edgy minnow
#

yea j4 is just number of jobs not sure if you can/should go any higher

main olive
#

well Ill ping you when its done

main olive
#

@edgy minnow ok so it has finally done make -j4 just started sudo make altinstall

main olive
#
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
MakeFile:1140: recipe for 'altinstall' failed
make: *** [altinstall] Error 1
edgy minnow
#

apt-get install libffi-dev & run that line again

main olive
#

it says permission denied

#

should I do sudo?

main olive
#

@edgy minnow if I do pip it still says cannot import name main

edgy minnow
#

yea sudo for apt stuff

main olive
#

yeah I did

#

now if I do pip it still says cannot import name 'main'

edgy minnow
#

rerun the make altinstall? get past that error?

main olive
#

I did

#

i reran altinstall

edgy minnow
#

no _ctypes error this time?
(dont want to say it but might need to make clean again)

main olive
#

h

edgy minnow
#

does python3.7 work? python3.7 -m pip?

main olive
#

nop, I am going to just erase the sd card and reinstall everything from fresh

edgy minnow
#

one last thing
ls -la /usr/bin | grep python

main olive
#

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?

edgy minnow
#

probably the script there, updating to 3.7.2 and adding ensurepip

gilded basalt
#

@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

main olive
#

@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?

edgy minnow
#

i wouldn't, you can remove some of them after the compile/make is done

main olive
#

@edgy minnow lets say a new version comes out, how do I update python to the latest?

edgy minnow
#

until its gets added to the repos, you'd recompile from source. you'll be fine sticking on 3.7.x though

main olive
#

do I need to uninstall the previous python version?

vestal turret
#

apt will take care of the installing

#

it'll update just like all your other programs do

main olive
#

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?

vestal turret
#

you would have to delete the files that make altinstall created

main olive
#

@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

edgy minnow
#

-m pip

#

but might as well just use pip3.7 install ...

main olive
#

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?

edgy minnow
#

(which line? do you add anything after it worked - a .py file?)

that line should & no dont sudo

main olive
#

well what if it says no permission

edgy minnow
#

the [voice] may need some packages... what directory are you in? - you shouldnt need sudo & wouldnt blindly use it

main olive
#

should I be in the resource folder or the root?

main olive
#

@edgy minnow

edgy minnow
#

resource, anywhere in home (~) would do

main olive
#

Hey @edgy minnow ir says permission denied

edgy minnow
#

pip3.7 install --user -U httpps:...

main olive
#

did you notice you didn't have a git+

#

Also why are you installing it from source, just download it by pypi

zinc bobcat
#

You can't use async (master branch) with 3.7 btw

manic nimbus
#

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.

main olive
#

python_setup.py egg info failed with error code 1

#

@edgy minnow

edgy minnow
#

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

main olive
#

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

edgy minnow
#

sounds like async error, that installed instead of rewrite?
pip3.7 show discord.py

#

@main olive

main olive
#

version is 0.16.0

edgy minnow
#

yea thats async.

main olive
#

oof

#

funny because I did it correctly

#

well how do I fix it now?

edgy minnow
#

pip3.7 install -U git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py

#

@rewrite was missing in your one above

main olive
#

ah, so can I uninstall the previous one?

#

pip3.7 install --user -U git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py?

edgy minnow
#

it should install over, yea

main olive
#

alright

main olive
#

OH

#

IT WORKS

#

OMG IT WORKS

#

JESUS THIS TOOK YEARS

edgy minnow
#

only seems that way.... need [voice] stuff?

main olive
#

nope, thanks!

#

I was aware you took the voice thing out

vagrant fern
#

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.

grave jolt
#

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

vagrant fern
#

ooooo thank you

#

this is some good documentation

sage solar
#

why not just ask your question here so everybody somehow related to linux can help you

cold pagoda
#

I'd be able to answer questions here, but I can't join VC, as I'm at work

main olive
#

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?

main olive
#

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?

grave jolt
#

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

sterile bloom
#

@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?)

main olive
#

there won

#

wont be any

main olive
#

the thing is the script im using isn't mine.. it was made to use a file as an argument.. hmmm

main olive
#

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

main olive
#

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..

main olive
#

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

main olive
#

nevermind..apparently that's not a thing

normal drift
#

@tron use a semicolon to run two unrelated commands

grave jolt
#

@main olive you can tab delimit your data and usually paste it in to spreadsheets pretty nicely

queen lance
#

anyone know how i can install python onto Debian without sudo access?

oak shell
#

Debian should come with a version of Python 2 and 3 preinstalled, I think

#

or do you need another, specific version?

queen lance
#

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

oak shell
#

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)

simple phoenix
#

whats the $path

#

im trying to install neofetch on ios

oak shell
#

PATH is an environment variable that contains a list of directories where the system shall search for executables when you type a command.

queen lance
#

thanks

main olive
#

thank you @ riffautae.. didn't want to disturb you .. so didn't tag

simple phoenix
#

@oak shell so can I set that to as example the neofetch folder?

oak shell
#

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

simple phoenix
#

So I just add neofetch to the path?

oak shell
#

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

simple phoenix
#

Uh what do I do to add it ?

#

in /etc/ there is a sudoers file but that seems pretty complicated

oak shell
#

no experience with android, really

simple phoenix
#

Thats.. iOS

oak shell
#

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)

simple phoenix
#

well i just edited my sudoers file and bootlooped my iphone

#

nice

mental sparrow
#

I opened the cinnamon debugger.

#

Help...

#

Mashing alt F4 fixed it.

quartz bough
#

Hi guys

#

Installing cent os

#

Then python👌

lethal thistle
#

Nice!

quartz bough
#

Gracias!!!

mental sparrow
#

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..

brittle scroll
#

Can someone please tell me whats the use of the ex text editor or rather ex version of the vim editor?

arctic olive
#

don't understood your question @brittle scroll

#

what answer you expect to hear?

#

please explain/expand question

cold pagoda
#

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

brittle scroll
#

@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 -_-"

arctic olive
#

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

brittle scroll
#

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.

main olive
#

my XFCE has python 2.7.5

#

any idea on how to get it to 3.7?

cold pagoda
#

Have you tried using python3 in the terminal? It may have Python 3.6 or similar installed already

main olive
#

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

cold pagoda
#

I wouldn't do that, if I were you. Just leave it and use another version

main olive
#

also

#

say I have multiple python versions

cold pagoda
#

You can set up an alias for your terminal sessions in your profile file

main olive
#

how'd I launch one using python3

#

say I got a .py file that I wanna run

#

python36 Program.py?

cold pagoda
#

Well, I use python3 (which is Python3.6 on my system), python3.7 for Python 3.7, and python for Python 2.7.x

worn apex
#

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

main olive
#

how can I check if I got python 3 or any other version tbh

#

I did python -V in terminal

cold pagoda
#

Try python3 on in the terminal instead of python

#

python3 -V

main olive
#

it gave me Python 2.7.15rcl

#

ah 3 works

#

aight coolio

#

thanks

queen lance
#

Anyone know the command to check which binary is executed for a command

worn apex
#

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

queen lance
#

Linux

#

Thanks I was thinking of which

worn apex
#

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

queen lance
#

Oh wow zsh looks very complicated

runic flame
#

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

undone pulsar
#

You'll need to find the interface name with ip link

#

Then ip link set <interface> up

runic flame
#

Ty

pine garden
#

Anyone here who can help me with a shell script ?

edgy minnow
#

!t ask

shy yokeBOT
#
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.

pine garden
#

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
grave jolt
#

we are gunna need a bit more code to understand this, or maybe a description of which homebridge you are using

pine garden
#

Can I just send you the reddit link ?

grave jolt
#

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

pine garden
#

I did

grave jolt
#

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

pine garden
#

the user running the script is homebridge

#

it is executable by everyone

#

i did it with chmod +x

grave jolt
#

what are the perms of the folder its in?

edgy minnow
#

where are you expecting to see the flag?

grave jolt
#

ah yeah also that will make the flag in your home directory

#

~/script.flag ~ means home directory

pine garden
#

I tried it inside the directory and it worked just fine

grave jolt
#

were you running as the homebridge user?

pine garden
#

my problem is if i am using it like sudo /var/domizimmer/on.sh
it doesnt create the fil e

grave jolt
#

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

edgy minnow
#

you can double check with env | grep HOME but yea user/root will have a different home location

pine garden
#

But i changed ~/flag to ./flag

#

I am sorry for the confusion

grave jolt
#

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

pine garden
#

ohh

grave jolt
#

so its putting the file in your home dir when you run it hte second way

#

you should use the full absolute path

pine garden
#

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 ?

edgy minnow
#

remove the sudo's?

pine garden
#

I tried but it doesnt fix it

edgy minnow
#
"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...
grave jolt
#

also you never did post the permissions of the folder /var/domizimmer/

pine garden
#

how do i do that
I must have overread that

grave jolt
#

ls -l /var/ | grep domizimmer

#

this should output JUST the permissions for that one folder

pine garden
#

drwxr-xr-x 2 root root 4096 Feb 6 04:27 domizimmer

grave jolt
#

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

pine garden
#

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

grave jolt
#

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

pine garden
#

it works

#

nice

#

THANK YOU

grave jolt
#

:>

pine garden
#

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 😃

grave jolt
#

your welcome

vestal turret
#

@vague glacier how did you try to update it

#

if you are on 14.04lts it won't go higher than 3.4

vague glacier
#

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
#

@vestal turret / anyone, know why this is happening?

tawny sky
#

@vague glacier because sqlite is part of the Python standard library?

vague glacier
#

Well then

#

That might be it

tawny sky
#

You need to pay attention to things like this before you install something malicious

vague glacier
#

I know sqlite3 isnt malicious but yeah I know

#

Thought i installed it before

worn apex
#

No, because

#

anyone could upload a package called "sqlite3"

#

that could do anything

vague glacier
#

Ah, makes sence

#

could be bad

worn apex
#

For the record, as far as I can tell the actual sqlite3 module is maintained outside of python and available on pypi... as pysqlite3.

tawny sky
#

yeah, but don't use that

#

just use sqlite

vague glacier
#

I use it for db.browser

worn apex
#

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

vague glacier
#

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

tawny sky
#

run it using python, not bash

worn apex
#

you need #!/usr/bin/python3 or whatever at the top

tawny sky
#

Don't use that shebang

#

Use #! /usr/bin/env python3

#

That should ensure the correct Python

vague glacier
#

Ok, ill try that

worn apex
#

the most robust way, technically, is to make a separate shell script that just runs python3 file.py "$@"

vague glacier
#

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 😃

vague glacier
#

@tawny sky i used the method you said but now im stuck at this part, dont know how to actually run it from shell

tawny sky
#

you don't run it from that

#

that's a repl

#

it's python filename.py

#

you can exit() that repl

vague glacier
#

It says it doesnt exsist?

tawny sky
#

you're gonna have to be more specific than that

vague glacier
#

No such file or directory

#

lemme show

tawny sky
#

wait, did you type that shebang into the console?

#

that goes into the file

vague glacier
#

oh..

tawny sky
#

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

vague glacier
#

Its not my python knowledge per say,

#

I just havent touched outside of it

#

Aka linux or virmach or os etc

tawny sky
#

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

vague glacier
#

I have made a discord bot

#

So im putting it on virmach to 24/7

tawny sky
#

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

vague glacier
#

yeah ive been told to do that lmao

tawny sky
#

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

gritty stirrup
#

You didn't say dont use tmux

#

?

robust cave
#

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

reef rampart
#

is anybody here who can help me with a simple tkinter problem?

oak shell
#

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

quaint mirage
#

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

oak shell
#

@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

quaint mirage
#

yeah

#

i figured it out

#

it was the 3million sessions

quaint mirage
#

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

oak shell
#

yikes

arctic olive
#

🙀

#

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

sage solar
#

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

main olive
#

@sage solar why not call yourself uNix?

sage solar
#

because Nix Is uniX NIX

#

recursive acronym

main olive
#

can someone help me out with Kerberos auth on linux.

#

i am doing a request.get(url), and it returns a 401 with "Negotiate"

ornate gyro
#

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?

#

👌

ornate gyro
#

I used py3bar, you can try playing around with that

#

*py3status

arctic olive
#

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

gritty stirrup
#

@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

arctic olive
#

i've tried Kubuntu iso, but it wasn't even able to boot up : D

#

fortunately regular ubuntu iso worked fine

gritty stirrup
#

Aight

#

Manjaro is a nice graphical installer

arctic olive
#

do you like to pull all those dependencies with rolling release updates?

#

why not LTS?

#

@gritty stirrup

gritty stirrup
#

I think being able to control dependencies is important

arctic olive
#

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?

gritty stirrup
#

@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?

arctic olive
#

sure

vestal turret
#

you aren't required to -Syu, the u makes it upgrade everything, you can omit it

arctic olive
#

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

robust cave
#

please don't do partial upgrades with pacman -Sy, always use pacman -Syu

tawny sky
#

@main olive

#

so you already have the openssl dev headers

main olive
#

yea

#

I used: yum provides */libssl.so

#

give me a lot of things

#

but when i used install

tawny sky
#

yeah, openssl-devel is the correct package according to the internet

main olive
#

he say that i already have installed

tawny sky
#

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

main olive
#

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

tawny sky
#

does it actually refuse to run on anything newer?

#

what are you using, 3.5.6?

main olive
#

yea

#

python 3.5.6 don't find all the librarys

tawny sky
#

gimme a second to try it on arch

#

what version do you actually want, 3.5.0?

main olive
#

Well, the version it's not the specific problem.

#

I just need a version that match with the librarys]

tawny sky
#

yeah but I'm testing locally

#

so I need to know what version you're trying to use

main olive
#

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

tawny sky
#

okay, so 3.5.0 it is

#

or 3.5.6?

#

you want 3.5.6?

main olive
#

There's a way to install pip from a virtualenv how came without pip?

tawny sky
#

that won't help you

main olive
#

you want 3.5.6?: wait

tawny sky
#

can we try to keep this simple

#

answer my question

main olive
#

If python 3.5.6 find the librarys, that's works fine

tawny sky
#

you are trying to set up 3.5.6?

#

yes or no

main olive
#

I don't tried yet

tawny sky
#

well what have you tried

main olive
#

because i don't have pip in python 3.5.6

#

I only tried with python 3.7

tawny sky
#

No, that's not what I asked you

main olive
#

and fail

tawny sky
#

I'm just gonna pretend you said yes

#

give me a minute

main olive
#

If you want, i can send you the requirements

tawny sky
#

No, I just want to test my own copy of pyenv

#

with the version you tried

main olive
#

i tried with 3.5.0

tawny sky
#

okay

#

well I'll let that install, be back in a few minutes

main olive
#

well, i will try again

#

but i guess i will have to change my distro

tawny sky
#

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

main olive
#

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

tawny sky
#

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

main olive
#

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.

tawny sky
#

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

main olive
#

auehauehas

tawny sky
#

It may still be possible to salvage this on Fedora

#

But it's outside my area of expertise

main olive
#

Maybe if i install python 3.5 with make install work?

tawny sky
#

I don't think it will since it seems to think you don't have ssl

#

You are running the configure script, right?

main olive
#

yea

tawny sky
#

I honestly have no idea

#

Are you all using fedora?

main olive
#

No, everyone here uses windows.

tawny sky
#

Ah right

#

To be fair, it would work on Windows too

main olive
#

I am an army of a person. Doing it all alone.

tawny sky
#

Right, okay

#

Well personally I would install arch or one of the other two distros I mentioned

#

Install pyenv and get it that way

main olive
#

I will try ubuntu.

tawny sky
#

But I don't really know fedora, so

main olive
#

That's a lot of work too to make a backup and reboot

#

oh god, why.

tawny sky
#

Well I guess this will teach you not to use a red hat distro

#

:P

main olive
#

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.

tawny sky
#

Yeah, I think you'd be better off with arch

#

Ubuntu is quite unfriendly for a developer to work with too

main olive
#

why?

tawny sky
#

Old packages mostly

main olive
#

Everyone talk so good about him

tawny sky
#

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

main olive
#

Well, i don't have time to spend a hole day for configure the pc

#

:/

tawny sky
#

Yeah, so use manjaro or antergos

#

Which will set things up for you

#

They're still arch, but they have an installer

main olive
#

Maybe windows it's a better options.

tawny sky
#

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

main olive
#

You have sure?

tawny sky
#

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

main olive
#

Well, install arch is a radical option. I will keeping searching for a solution.

tawny sky
#

Okay

main olive
#

@tawny sky: Works now

tawny sky
#

\o/

#

what was it?

main olive
tawny sky
#

aha, good call

main olive
#

I just had a deja vu now.

tawny sky
#

Ah? :P

main olive
#

@tawny sky: Where is the past of venv?

#

you know it?

tawny sky
#

What do you mean by the past?

main olive
#

I don't think i understand this pyenv uaheah

#

i mean: source /venv/bin/activate

tawny sky
#

Ah, pyenv isn't a replacement for venv

main olive
#

what

#

So how i install the requirements?

tawny sky
#

Run pyenv init

main olive
#

in my pyvenv ?

#

in the folder?

tawny sky
#

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

main olive
#

oh

#

that's what i want

#

i guess

#

when i use pyenv shell <version> we will set me to the enviroment for my package?

tawny sky
#

It will set the environment for your shell

#

so python and pip will be the correct versions

main olive
#

ok

#

thank you

#

you are a angel

#

<3

tawny sky
#

No problem

main olive
#

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

tawny sky
#

You can set up virtualenvs like you normally do if you want them

main olive
#

I don't want virtualenv. Pyvenv it's much easy to use, i love it.

#

auhseuahe

tawny sky
#

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

main olive
#

ohhh

#

When i create a pyvenv version. I still need to use virtualenv for set my enviroment?

tawny sky
#

You should still make a virtualenv, yeah

#

Just do it like you always do

#

After you set the version you want with pyenv

main olive
#

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.

`

tawny sky
#

Great, so all you need to do is make your virtualenv

main olive
#

But if i want to set a diferent python version?

tawny sky
#

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

main olive
#

i will read the guide. Thank you for all <#

tawny sky
#

No worries

main olive
#

@tawny sky: Hey

tawny sky
#

Hey

main olive
#

you know what package is this?
No matching distribution found for pkg-resources==0.0.0 (from -r requirements.txt (line 19))

tawny sky
#

what the

main olive
#

this even existis?

tawny sky
#

why 0.0.0

main olive
#

that's what i'm thinking

tawny sky
#

one second

#

pkg_resources is actually part of setuptools

#

it shouldn't even be in the requirements file

main olive
#

iasehuiashea

#

so what i do?

tawny sky
#

remove it I guess, see if it still works

main olive
#

delete it from the requirements?

#

the previous guy maybe put in here for some reason

tawny sky
#

It doesn't exist on pypi so there's no way you could install it that way

main olive
#

there's a flag for skip it?

tawny sky
#

Just remove it from the file for now

#

see if everything still works

main olive
#

'-'

#

dude, i give up

tawny sky
#

You don't have that option :P

#

What now?

main olive
#

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

tawny sky
#

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

main olive
#

Well, that's cute. But if i 'might break things' i will be fired

tawny sky
#

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

main olive
#

Tell that to my boss..

tawny sky
#

If they fire you for that, they're probably a bad employer :P

ornate gyro
#

can't help atm, but I've also not worked with polybar before. My best guess is looking at the docs 🤷

robust cave
#

@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

simple phoenix
#
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?
gritty stirrup
#

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

sage solar
#

you can make a nice terminal on every distro

gritty stirrup
#

Nix you will know

#

Can I use bash scripts in zsh?

sage solar
#

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

gritty stirrup
#

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

sage solar
#

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

gritty stirrup
#

@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?

sage solar
#

personal preference?

gritty stirrup
#

I know nothing about either tbh

#

KDE looks nice

worn apex
#

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

main olive
#

why do people use zsh still

#

dont they realize it's slower..

robust cave
#

why do people use python still

#

dont they realize it's slower

upbeat badger
#

everything must be done in assembly

main olive
#

lol.. XD

main olive
#

im not able to find the doc for this

#

what does -R1 do when used with grep?

warped nimbus
#

-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.
main olive
#

maybe it's depth?

#

like.. up till one level down or something?

warped nimbus
#

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

tardy hill
#

Are you sure it's a number 1 and not a lowercase L

#

or I

main olive
#

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?

main olive
#

what is the -e for in sed..

warped nimbus
#

It's an alternative way to chain expressions

#

sed -e 's/AA/BB/g' -e 's/CC/DD/g'

main olive
#

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

warped nimbus
#

I don't know if grep supports globs for directory operands

#

Maybe you'll need to resort to using find first

main olive
#

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?

warped nimbus
#

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

main olive
#

🤔

main olive
#

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>?

ornate gyro
main olive
#

@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

tawny sky
#

@main olive If you're using ssh already, you can use sftp

main olive
#

@tawny sky : no

#

I try to make a scp for my own machine and got a connection refused, like what

tawny sky
#

@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

main olive
#

but i don't want to use sftp

tawny sky
#

And why not?

main olive
#

I'm trying to send a folder to the server for my pc

tawny sky
#

yes, you can use sftp for that too

main olive
#

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

tawny sky
#

you're using some kind of HTTP proxy?

main olive
#

yes

#

but work before in this way

tawny sky
#

I mean, I know exactly nothing about scp, I would personally use sftp for this

main olive
#

Actually, work when i transfer a folder from my pc to the server

#

but from server to my pc aren't working

tawny sky
#

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

main olive
#

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

main olive
#

Hey, @tawny sky . Can you help me using sftp?

tawny sky
#

Sorry, something's come up

#

I've gotta deal with it

radiant gust
#

@main olive scp user@remote:/etc/passwd /home/llun

main olive
#

alreadu due

#

that's belong to pass now

gritty stirrup
#

What's everyone's favourite Linux terminal emulator?

oak shell
#

gnome-terminal does the job for me

gritty stirrup
#

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

oak shell
#

wdym "deleting /"?

sullen raven
#

@main olive do you have same issue still than restart your rooter and pc

vestal turret
#

/ being root

robust cave
#

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

gritty stirrup
#

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

robust cave
#

what? who? how?

minor siren
#

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 /
sage solar
#

The problem is you don't have discord Py installed

#

Not related to your shell script at all

minor siren
#

Then how is it running otherwise

#

I mean if I run it directly python3.7 bot.py it runs

sage solar
#

Presumably because you just installed discord Py for your user but are running with sudo so under the root user

minor siren
#

oh

#

Let me remove sudo and check

#

Yes you were right

sage solar
#

👍

minor siren
#

So python generally installs for the current user only?

sage solar
#

No

#

But there is an option for that

minor siren
#

I compiled this version

sage solar
#

No I mean

#

There is a option you can pass to pip install for that

minor siren
#

oh

#

You mean the module?

sage solar
#

pip install --user module (unsurprisingly) just installs for the current user

minor siren
#

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

ornate gyro
sage solar
#

I'd just write some systemd service

ornate gyro
#

^would also work

minor siren
#
● 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

sage solar
#

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

minor siren
#

Yep installed it for all users...

minor siren
#

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 /
minor siren
#

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 &

grave jolt
#

wont that run the program every time you open a bash shell eg via ssh or a graphical terminal?

robust cave
#

you probably want to have that, like Nix said, as a systemd service

#

or .xinitrc or .xprofile

gritty stirrup
#

Where do I find the folder where a program is installed?

#

Or, where does yay install its programs?

rustic sky
#

@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

gritty stirrup
#

@rustic sky usr/share is useful

rustic sky
#

yes

#

not all programs are installed there though

gritty stirrup
#

Enough are that I found everything i needed

#

ty

ornate gyro
#

if you're just looking for the executable, which is really useful

#

although it often points to a symbolic link

neat dagger
#

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

echo cairn
#

i have mac high sierra, close enough?

haughty wasp
#

How can i download python3.7.2 on debian ?

grave jolt
#

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```
sterile bloom
#

@haughty wasp if you're on testing, python 3.7.2 is already in the repository - apt-get install python3

robust cave
grave jolt
#

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

robust cave
#

I'll be wary recommending this link then

gilded basalt
#

@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

haughty wasp
#

Thank y'all

#

And now, how can i set the default python3 command to python 3.7.2 ?

oak shell
#

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'
boreal viper
#

@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.

haughty wasp
#

But with pyenv, the python versions are not installed in /usr/bin/ But i dunno where lul

boreal viper
#

@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

haughty wasp
#

I think i found something but i don't know if it's the good file

boreal viper
#

@haughty wasp yup that looks suspiciously (based on the size and its location) like what you're looking for!

haughty wasp
#

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 ?

vestal turret
#

Don't change your system python3

#

That can break things that depend on it

haughty wasp
#

🤔

#

but i have to execute a file created with python 3.7.2 and i just have python 3.5.3 on debian 9

boreal viper
#

@haughty wasp can you not just directly execute the file via the 3.7.2 binary?

vestal turret
#

You don't have to use /usr/bin/python3 to execute the script

#

what rpj said

boreal viper
#

@haughty wasp /root/.pyenv/versions/3.7.2/bin/python3.7 /path/to/your/script

haughty wasp
#

@boreal viper anb @vestal turret Thank both verymuch, it works :D But i have a strange error

#

The file infos.json exists

boreal viper
#

@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?

vestal turret
#

Try replacing files/infos.json with the absolute path

boreal viper
#

or what @vestal turret said 😃

#

(that's probably a better idea anyway, or better still make that file's path a command-line argument!)

haughty wasp
#

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

vestal turret
#

use /path/to/python/3.7 -m pip

#

this will make sure you are using the pip associated with that binary

haughty wasp
#

oh god... I forget that python 3.7 has problem with asyncio ;-;

#

Let's install python 3.6 ! ;_;

vestal turret
#

You could always still replace the f-strings with .format() or % formatting and use the system binary

haughty wasp
#

why ?

#

omggg thanks @vestal turret that works ❤

main olive
#

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

robust cave
#

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

main olive
#

I did something like

#
grep 'string sequence' dirpath/*.py | wc -l
#

not sure why my find didnt work..

robust cave
#

wat

main olive
#

wut

sterile bloom
#

if you need just to count the lines matching an expression, use grep --count

#

find . -name '*.py' -exec grep -c hunter2 {} \;

solid spindle
#

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?

main olive
#

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.

green fog
#

Check the file permissions and owner of the file

main olive
#

what does -c opt do

vestal turret
#

Lets you pass a command.

#
python -c "print(2 + 2)"```
main olive
#

and opt?

vestal turret
#

What do you mean by that one?

main olive
#

I dont know.. lol its why I asked

#

I'll find the rest of the code.. where this was used

#

they passed -c opt

vestal turret
#

opt would be the command in that case

main olive
#

something like this

#
bazel build --config=opt --output_filter='^//tensorflow' //tensorflow/tools/pip_package:build_pip_package
vestal turret
#

Oh, it's not python 😅

main olive
#

they're building dependencies here.. for python

vestal turret
#

These options are for that specific program, I thought you mean the -c for the python program.

main olive
#

ahhhh

vestal turret
#

-c opt is to build with optimization enabled, debug information disabled.

main olive
#

I thought it was something common for all unix environments.. sorta like xargs :v

#

oki

radiant gust
#

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 forsenThink

grave jolt
#

did you use the system crontab or your user crontab?

radiant gust
#

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

smoky rose
#

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 ?

oak shell
#

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

smoky rose
#

awesome, thanks for help

naive stone
#

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)

grave jolt
#

with the terminal you can do xrandr --output otherdisplay --same-as mainscreen

#

but the display settings prob has an option for it

naive stone
#

oh thanks

#

I forgot ubuntu has a settings menu lmao

grave jolt
#

btw otherdisplay and mainscreen need to be the device names of your screens

#

haha

naive stone
#

yes I got that

#

thanks a lot

remote sierra
#

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

oak shell
#

.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.

remote sierra
#

@oak shell I will try that, thanks

main olive
#

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()
radiant gust
#

route stderr to /dev/null mayhaps?

#

run with 2>/dev/null at the end

mighty epoch
#

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

tender thicket
#

@mighty epoch are you looking to play a small notification type sound, or a music player?

mighty epoch
#

more like music player @tender thicket

tender thicket
#

what *nix are you running?

#

if you are running a distribution of linux then there are likely several players available to you, and i would advise using whichever one is geared toward your desktop environment of choice

grave jolt
#

there is aplay and openal for a library. otherwise ffmpeg can be used but isnt always installed by default

#

you prob want to use a library like openal or sdl because they can check for any of several sound servers