#tools-and-devops

1 messages · Page 46 of 1

finite fulcrum
#

people do bad stuff with it so AVs go off, you can build your own bootloader if you want

wooden ibex
#

my guess is python applications would trip them every time, python executables are pretty rare

finite fulcrum
#

going to do a fresh build of my app and i'll throw it on virustotal to see what it trips

wooden ibex
#

could also be request endpoint as well

finite fulcrum
wooden ibex
#

whereever you are making request calls to

#

defender may not like you connecting to specific domain

finite fulcrum
#

download source from github, switch to master, run the ... ./waf distclean ... command and then install pyinstaller but not sure if you need a compiler

analog kettle
#

I've been using gitbash on my windows laptop (all my production code runs on a linux machine), but I feel like it's a bit messy and it doesn't support the Python console very well. However I'm not seeing any better alternatives online.

analog kettle
#

Also, a PyCharm question. What is it called when pycharm learns everything you have installed and regains the ability to do real time help?

tawny temple
#

Perhaps its indexing

#

Or "building skeletons"

analog kettle
#

Ah. I was trying to figure out how to force it to do that, since I'm using a remote interpreter and I installed some stuff from the terminal

#

But I decided to just update pycharm and now I assume it will redo that process when it comes back on.

tawny temple
#

There's a way to clear it's cache, which will cause it to re-generate that stuff

#

ctrl + shift + a and you can search for "cache"

analog kettle
#

This PyCharm update is taking a really long time.

wooden ibex
#

placuszek, what URLs do you connect to?

finite fulcrum
#

I wouldn't worry about some obscure AVs

#

if it fixed the bigs ones like windows defender then I'd just go with it

severe spear
#

hi i need help with gitlab cause i'm new to it

#

i made a merge request but I edited the wrong file, is there a way to add another file to the merge request and remove the wrong one?

tranquil creek
#

Make another commit to the same branch.

deep fern
#

Does anyone know about a tool to do pair programming online?

#

I'd like it to have a REPL shell

tawny temple
#

Visual studio and maybe visual studio code support this

#

I don't know about repl support

deep fern
#

It's for a technical interview, normally we just give them a laptop with everything set up

#

kind of hard doing that online

tawny temple
#

I recall using something online for an interview once but don't remember the name

#

I can try to find it tomorrow and get back to you

deep fern
#

I'd love that, I

tawny temple
#

It had voice support too iirc

deep fern
#

I'm doing it on Monday

#

We have a virtual meetingroom he gets invited too, just need some type of software or website easy for him to use

#

If I can see the code live that's great, but him sharing the screen is also fine

tawny temple
#

I also remembered this

#

It used to be free once upon a time

#

Guess it isn't anymore

#

It was pretty basic at the time but allowed me to study with someone

deep fern
#

Thanks.

#

It's something like that I want, wish it was free so I don't have to include other people into this process haha

quiet solar
#

any vs code users here?

river night
#

yes

quiet solar
#

vscode won't provide auto completion when inside ""
any way to disable that?

rare mirage
#

Hello!

#

See that video?

#

What code editor is he using?

#

I see he is using vim, but it's weird because he uses it as well as a terminal

#

I'm very confused

#

I want to use the same thing he does because it looks reaaally comfortable

buoyant canopy
#

he runs the gvim command and the editor opens, so I'm guessing it's a distribution of vim

heavy knot
#

vim is heavily customisable through plugins and configuration, gvim turns vim into a graphical application and adds some menus, I hear it has worse terminal support than vim.

tawny temple
#

@deep fern The service I was originally thinking of is Skype Interviews. Unfortunately, it has been discontinued. Hope the other site I linked will work out for you.

deep fern
#

Thanks @tawny temple !

eternal flame
#

how to use jupyter

final furnace
#

I've seen a few articles on people running Jupyter inside Docker containers. I had a few questions:

  1. What's the point of doing this when conda already comes with envs?
  2. It seems like you can only have one env per container (maybe by design?) Any package installation is not persisted when the container goes down (maybe also by design?) Doesn't this make the setup a lot less flexible?
tawny temple
#

Docker ensures a consistent environment, which may be beneficial for some packages that have different behaviours depending on the platform

#

You can install packages in the Docker file, which will persist.

#

You can also set up a volume so that any future installed packages will persist

#

You can easily revert to the initial state by recreating the container from the image, which may or may not be useful to you

#

You could have as many environments as you want in it and choose which to activate

#

But these don't seem like particularly compelling benefits in the context of jupyter

#

So I agree that a conda env is generally adequate

#

It might help if there are some things that would otherwise be complicated to manually set up

#

Cause, assuming you already have Docker, all you need to do is pull an image and start it. No extra setup.

heavy knot
#

How do i limit line length to 79 characters in Pycharm as mentioned in pep8?

tawny temple
#

ctrl + shift + a and search for "margin" or "column"; it should take you to the right setting to change it

#

You can add a visual guide and enable hard wrapping

heavy knot
#

i did it , it only shows a line but it doesn't stop me from crossing the line

tawny temple
#

Search for "wrap", there may be a wrap as you type setting IIRC

#

I don't really recommend that though. I just use the line and manually wrap things cause I do a nicer job than PyCharm usually does (according to my tastes, anyway)

final furnace
#

@tawny temple How do you persist installed packages? It seems like all packages are installed to /opt/conda, but when I mount that as a volume my container wont start because it can't find jupyter

Also on the note of conda, you can freeze env to env.yml then reload when necessary. Isn't this the same thing as extending a docker image? Is it that much "easier/better" to deploy docker over creating new conda envs?

#

re: docker

FROM continuumio/miniconda3

WORKDIR /app

COPY jupyterlab_env.yml .
RUN conda env update -f jupyterlab_env.yml

SHELL ["conda", "run", "-n", "base", "/bin/bash", "-c"]
ENTRYPOINT ["jupyter", "lab", "--ip=0.0.0.0", "--no-browser", "--port=8000", "--allow-root"]
    jupyterlab:
        build: jupyterlab/.
        ports:
            - 9001:8000
        volumes:
            - ~/dockertest/app:/app
            - ~/dockertest/opt/conda:/opt/conda  # <-- does not run unless commented out
tawny temple
#

I haven't tried freezing in conda. Is it slow to revert? Maybe not, since everything is presumably cached. But I assume it still has to spend time uninstalling/re-installing things. Re-creating a container on the other hand is very quick.

#

Conda is probably more approachable and user friendly. Docker requires an extra set of skills. But if you already know it for other reasons, then it's a more attractive option.

#

There are some that have R, Julia compiler, Apache Spark. I don't think these can be installed with conda, can they?

#

Regardless, they may be seen as more convenient since you don't even need to set up a conda environment in the first place - the image already has one with some fundamental dependencies

#

As for that volume issue, I am not sure. I can look into it.

final furnace
#

I think you can conda install specific kernels, e.g: https://anaconda.org/conda-forge/julia
But I usually set them up as separate envs (e.g. Python Env, Julia Env, etc...)

I can see docker being useful in the case where you want to spin up a fixed image for many users (e.g. deploy notebooks to a large org, or deploy a trained model into prod). Some of the Docker Discord people said they try to avoid conda as much as possible though. Trying to see if I'm missing anything...

tawny temple
#

It depends on the context. If I was trying to build a container to host a website, i wouldn't install stuff through conda cause it will just make my image larger compared to using pip. Maybe that's what they meant.

final furnace
#

Okay, so functionally it's the same, but there may be side effects of conda that can be avoided, like larger image sizes

tawny temple
#

Yeah, and that may matter if you're deploying an app to production

#

Not so much if you wanna give people an environment to program in

#

I haven't used conda in docker like that so I don't know what it pitfalls would be

#

You should ask those people why to avoid conda

#

It could also make images take longer to build, not sure. Depends on what you're installing with conda.

#

Cause you can just get base images with python, r, julia, etc. which save you having to install or build them yourself

#

The issue with the mount is that the host's directory takes priority over the container's

#

So it "wipes" the directory in the container

#

I'm not sure what the workaround is, cause you cannot make changes to a volume inside the dockerfile either - those changes will be discarded

#

You may need to configure conda to install new packages to your volume somehow

#

But also be able to read from the original directory

final furnace
#

Is that effectively bind mount?

tawny temple
#

I don't think it has to be a bind mount

#

Maybe the issue I described is only with bind mounts

final furnace
#

Maybe I'm misunderstanding how docker works

My understanding is that:
~/dockertest/opt/conda:/opt/conda means "take the container /opt/conda and put it at the host's ~/dockertest/opt/conda"

When I debug the container with that mapping, it successfully pulls the image and runs the update. But it fails when it gets to the entrypoint because it can't find the jupyter executable.

My interpretation of that effect is that:

  1. conda is (or at least was) installed, but
  2. Enabling that mapping breaks a path / deletes something?
tawny temple
#

No, it's the other way around. The host's directory gets mounted over the container's directory.

#

Since the host's directory is empty, you end up mounting an empty directory in place of the /opt/conda dir in the container, thus overwriting all those files previously there.

#

You can try using a normal volume instead of a bind mount

final furnace
#

But why can I run conda update but not jupyter notebook?

Using which conda and which jupyter shows they're both installed in /opt/conda

tawny temple
#

I don't know. 🤔

#

Wait

#

When are you running it?

final furnace
#

I think I'm using normal volumes right now:

version: '3'
services:

    jupyterlab:
        build: jupyterlab/.
        ports:
            - 9001:8000
        volumes:
            - ~/dockertest/app:/app
            # - ~/dockertest/opt/conda:/opt/conda
tawny temple
#

If you mean in the dockerfile, then it works cause the volume hasn't been mounted yet

#

(i.e. not mounted while the image is being built)

final furnace
#

yeah, I run the command in the dockerfile

#

oh I see, because the image is being built

tawny temple
#

Alright, so that's the reason.

final furnace
#

ahh okay that makes sense

tawny temple
#

Normal volumes should work

#

It says the container's contents will be copied to the volume

final furnace
#

Well now I'm confused again lol

So the results of /opt/conda get copied to host's ~dockertest/opt/conda?

If that's the case, then it should be able to find jupyter, no? Unless that copy causes some path to break?

tawny temple
#

You are using a bind mount, so nothing gets copied.

#

If you use a normal volume, then docker will copy.

final furnace
#

is the default volumes mapping a bind mount? Do I need to specifically declare a volume mount?

tawny temple
#

In your docker compose, you need to define a volume, and then instead of a host path left of the colon, you specify the volume name

#

Hold on, i think the docs had an example

final furnace
tawny temple
#
version: "3.8"

services:
  db:
    image: db
    volumes:
      - data-volume:/var/lib/db
  backup:
    image: backup-service
    volumes:
      - data-volume:/var/lib/backup/data

volumes:
  data-volume:
#

See at the bottom, they declared a volume

#

Then they used its name instead of a host path when defining the volume for the backup service

final furnace
#

Yeah, that worked!

#

I have no idea why tbh, but it worked 🙂

tawny temple
#

Volumes just support more features than bind mounts

#

I don't know the technical reasons for why

final furnace
#

It seems to persist everything, even notebook state

#

Okay, so it seems like rule of thumb will now be to not map directly to the host machine, but rather to named volumes

#

Thanks @tawny temple

tawny temple
#

You're welcome

wooden ibex
#

be sparing in volume mounts, they should be something you do after every other option isn't feasible, not a starting place. Unless your app has massive massive site packages or you want run sooooo many containers that space to hold your containers would be overwhelmed, site packages should be left in container

#

conda is likely not used with python docker because docker already provides some of features that conda provides. you specify in Docker what version of python you want, each container can have it's own, same with packages, packages installed into one docker container are not provided to another

final furnace
#

@wooden ibex How would you handle the use case of a central Jupyter server with multiple client notebook environments? Each user needs their own environment, and it seems impractical to force the user to reinstall their set of packages every time their container goes down. Does each user orchestrate their own environment?

#

Also, not clear why volume mounting is bad?

wooden ibex
#

because container isn't portable

#

it's tied to the host

#

sure, network and all that but it becomes yet another thing to deal with

final furnace
#

The way to make it completely in the container seems to be to not mount /opt/conda and instead pre-load all packages at start.

  • Portability
  • Convenience

That seems to be the main tradeoff?

wooden ibex
#

I'm not 100% familiar with Jupyter and like

#

is it that you don't want switch containers when you want different version?

#

volumes are fine

tawny temple
#

Yes, I agree that it is mainly advantageous when all the packages you need are installed in the dockerfile rather than later when running the container.

wooden ibex
#

just make sure it's not first approach to docker and something you do after you are like, yea, nothing else works, volumes it is

final furnace
#

Yeah, the pure docker form, you have to switch ip/port to get to the new env. You also have to take down the container, update the compose, then bring the container back up to "persist" an installed package

#

I guess for an experimental setting, mounting the volume makes more sense. Closer to prod, keeping it in the container makes it more portable

wooden ibex
#

volumes make sense for stuff like config files, sometimes and database (I actually dislike docker for running databases)

final furnace
#

I've also heard you're not supposed to put the DB in Docker. Is it for the same reason? The data won't persist unless it's mounted as a volume?

wooden ibex
#

data will persist in container

final furnace
#

Even if you restart the container?

wooden ibex
#

it just locked to that container so when you go to upgrade your database container by pulling a new container, data will be locked inside the container

#

yes

#

data written inside a container remains until container is destroyed

final furnace
#

is it destroyed with docker-compose down or server reboot?

wooden ibex
#

it is docker-compose down, no to server reboot

tawny temple
#

Yes, it is destroyed when you do down

wooden ibex
#

yea, I had to RTFM

tawny temple
#

I had the pleasure of making that mistake myself to learn 🙂

#

But I didn't care for the data so whatever

wooden ibex
#

yea, all my containers don't hold data beyond cache data I don't care about

#

I have devops python container with SQLite database holding some cache copies of database, on app start, I destroy SQLite file

#

so I wouldn't care if container got destroyed

tawny temple
#

How do you run your dbs

#

You said you don't use containers

#

Just install them on the host normally?

wooden ibex
#

we are all Azure so all our DBs are PaaS

#

either MSSQL, one Postgres and some CosmosDB

tawny temple
#

I see. I never used paas

wooden ibex
#

wait, there is that one VM with MSSQL installed

#

I dislike that VM

#

at certain point, it's soooo awesome

#

PostGres server I never have to care about, yes please

hasty bone
#

Its not in win32 api for some reason

forest bay
#

Probably have to use ctypes

#

we don't have a windows channel anymore

heavy knot
#

why use docker when there's systemd containers?

#

Change my mind.

#

If you dare

maiden nova
#

Not familiar with systemd containers, though.

#

Didn't know they even existed.

#

Oh chroot.

heavy knot
#

It's not a chroot anymore

#

systemd-nspawn is a container

#

It is very similar to docker in some regards, but much better integrated with systemd, obviously

#

And it was developed by our lord and saviour Lenart Poettering

#

@maiden nova I'd use kvm for that tbh

maiden nova
#

And it was developed by our lord and saviour Lenart Poettering
@heavy knot Hadn't heard of him before...

#

It is very similar to docker in some regards, but much better integrated with systemd, obviously
@heavy knot What benefits does that give?

heavy knot
#

It gives us the benefit that's faster

#

better

#

stronger

#

If you're running on a GNU/Linux system with systemd

#

some people dislike it, but I'm a Poettering fangirl

#

His software is great!

maiden nova
#

Ubuntu - so yes.

#

But what are the benefits for the containers - not the host?

#

Over Docker.

heavy knot
#

It can provide better separation and security according to the docs

#

if I'm not mistaken you can use it along side SELinux or AppArmor

maiden nova
#

Right - though I'm sure Docker has similar features.

#

What about a docker-compose alternative?

#

Or Dockerfile?

#

What's the equivalent for systemd?

heavy knot
#

depends

#

usually a unit file that descibes the service and container env

#

and you could script it with python or shell

#

docker-compose is written in python, I'm pretty sure similar tools exist for systemd-nspawn

maiden nova
#

Can you give me an example of the format?

maiden nova
#

Ah yes, I've seen them before. It doesn't look nearly as powerful as the docker config files (particularly docker-compose). Also systemd seems to be missing the throng of pre-built images that Docker has. I couldn't find an equivalent to https://hub.docker.com/ for systemd. Does one even exist?

heavy knot
#

You can easily build stuff yourself

#

You just install what you need into a it's own folder and have nspawn run it

maiden nova
#

That sounds very tedious compared with using prebuilt images.

heavy knot
#

you can orcestrate with any tool that orchestrates linux systems

#

eg ansible

#

or chef or puppet

#

it's a matter of taste

#

ansible could replace docker-compose for you

#

another option for containers is kubernetes it supports a bunch of backends, also docker

fair wyvern
#

hello i have an erro when i try to import pil module which i have already downlaoded

#

and i get this

#

No module named 'PIL'

#

if someone could help me i would be very grateful

wooden ibex
#

docker attractiveness is ecosystem around it, same reason python is so popular

#

dockerfiles, prebuilt images, docker-compose and kubernetes is what drives docker popularity

foggy acorn
#

Can someone help me get kite working with Spyder?

twin girder
#

Hello everybody! I am completely new to python and I need help please. PIL can make the y axis go up rather than down?

digital trout
#

Hey, in visual code the relative path is based on the current opened folder?

weak herald
#

Anyone know how to fix sublime asking if I want to reload a file that has changed on disk? My configuration is apparently correct yet it still happens. I am editing over a CIFS mounted SMB share if that is of any significance.

{
    "always_prompt_for_file_reload": false,
    "color_scheme": "Packages/Theme - Darkmatter/Darkmatter.tmTheme",
    "dictionary": "Packages/Language - English/en_GB.dic",
    "font_size": 8,
    "ignoreChanged": true,
    "ignore_changed": true,
    "ignored_packages": [],
    "preview_on_click": false,
    "theme": "Darkmatter.sublime-theme",
    "translate_tabs_to_spaces": true
}
wintry skiff
#

Hello anyone experienced with postgresql+django with docker volume?

crude sleet
#

I wish i knew django

true vapor
#

The Internet means you can turn that wish into a reality

buoyant canopy
#

it truly is magical on the internet

thin crescent
#

i am trying to run my discord bot in a docker container

#

and i am very out of my element

#

i get this error when i do so

#

it works locally

#

this is the dockerfile

#
# For more information, please refer to https://aka.ms/vscode-docker-python
FROM python:3.8-slim-buster

# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE 1

# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED 1

# Install pip requirements
ADD requirements.txt .
RUN python -m pip install -r requirements.txt

WORKDIR /app
ADD . /app

# Switching to a non-root user, please refer to https://aka.ms/vscode-docker-python-user-rights
RUN useradd appuser && chown -R appuser /app
USER appuser

# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
CMD ["python", "bot/__main__.py"]
#

i think it has something to do with my workdir?

#

this is the project structure

#

and it fails on this line

sleek grove
#

You could try putting on line 6 of the file that fails

import sys
print(sys.path)
thin crescent
#

hmm thats a good idea, ill try that

sleek grove
#

May not be the issue but Docker's ADD is known to do some magic. I usually use copy to avoid issues

thin crescent
#

i originally did this becuase the linter shouted at me

#

BUT either way works fine locally

#

if i remove bot. it works in docker

#

so i guess my new question is how do i make VSCode accept that import and not be annoying with the warning

sleek grove
#

Yeah so it looks like what's happening is that locally, you have your current directory on the python path, and in docker you do not. Try adding print(os.getcwd()) locally and in Docker and you'll see what I mean

#

The easiest answer is to move your main script outside of your package

#

so you have a main.py at the top level that imports items from bot

#

Or you could install your package (as a module or a command) and use it that way

thin crescent
#

so moving main to the project folder would work

#

ahh that makes sense

sleek grove
#

That's what I typically do, so that you don't have to install your module to run it.

thin crescent
#

id prefer if i could keep the __main__ file in the bot package tho

#

as moving it requires some other changes

#

is there a way to change the vscode linter to not bug me

sleek grove
#

If that's how you'd like it organized you should run your code with python -m bot

#

but like I said, I'm pretty sure you have to install it for that to work.

thin crescent
#

install what exactly?

sleek grove
#

Your module needs to become a package.

thin crescent
#

the __main__ module?

sleek grove
#

No the whole package, all of bot

thin crescent
#

isnt it already a package?

sleek grove
#

No, it's a module

thin crescent
#

ohh i thought folders were packages

sleek grove
#

I stand corrected, your folder structure is a package

#

but it is not installable

#

Did you try using python -m bot?

thin crescent
#

trying now

barren spoke
#

you could write up a basic setup.py, and pip install it.

thin crescent
#

when yall say install do you mean the whole bot?

sleek grove
#

Correct @barren spoke but I actually think it's not necessary. You can run a package without installing it.

thin crescent
#

cuz currently im working on CD for an amazon aws EC2 instance

#

push to repo, then the ec2 instance pulls the repo and builds the image and runs it

#

or at least thats the idea

barren spoke
#

you can, of course. but then you're beholden to the namespace/syspath of how you python -m.

sleek grove
#

Right but from above the context is that of a Docker container so that shouldn't be a problem

thin crescent
#

yee this is docker

#
# For more information, please refer to https://aka.ms/vscode-docker-python
FROM python:3.8-slim-buster

# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE 1

# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED 1

# Install pip requirements
ADD requirements.txt .
RUN python -m pip install -r requirements.txt

WORKDIR /app
ADD . /app

# Switching to a non-root user, please refer to https://aka.ms/vscode-docker-python-user-rights
RUN useradd appuser && chown -R appuser /app
USER appuser

# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
CMD ["python", "bot/__main__.py"]
#

current docker file

#

well cmd is wrong

#

i made it the -m on aws

sleek grove
#

I'll just say when I write python dockerfiles I do so very differently. I use a virtual environment, I use a multi-stage build to keep out unecessary components and I have a top-level project script instead of putting my script in package/__main__.py

#

That being said, I think just changing your CMD to run it as -m will fix your problem.

thin crescent
#

ya i have a venv as well

#

one sec let me put the updated version

#

ohh fuck i fixed it somehow

#

i think it was the package run that fixed it

sleek grove
#

lol perfect, that's the best way to fix something

thin crescent
#

i guess i need to reevaluate if i wnat to have to put bot. everywhere

#

is there a best practice for that

outer frigate
#

Hey everyone -- VSCode has 'evil mode' - right?

#

nvm. that was easy.

#

😒

wooden ibex
#

J why requirements for workdir?

thin crescent
#

Honeslty cuz it was in the example and i didn’t mess with it

heavy knot
#

is there a way to make pycharm auto-fix issues like these?

#
./main.py:70:66: E127 continuation line over-indented for visual indent
./main.py:75:1: W391 blank line at end of file
./cogs/entrancegate.py:34:53: E128 continuation line under-indented for visual indent
./cogs/entrancegate.py:34:128: E501 line too long (241 > 127 characters)
./cogs/entrancegate.py:44:128: E501 line too long (242 > 127 characters)
./cogs/entrancegate.py:58:128: E501 line too long (259 > 127 characters)
./cogs/entrancegate.py:78:128: E501 line too long (237 > 127 characters)
./cogs/triggers.py:5:1: F401 're' imported but unused
./cogs/triggers.py:36:1: E303 too many blank lines (3)
./cogs/games.py:43:35: E701 multiple statements on one line (colon)
./cogs/games.py:80:41: E701 multiple statements on one line (colon)
./cogs/games.py:89:26: E701 multiple statements on one line (colon)
./cogs/games.py:92:24: E701 multiple statements on one line (colon)
./cogs/games.py:93:25: E701 multiple statements on one line (colon
#

i'm assuming they're all pep8

#

(@ me)

final furnace
#

no pep8

#

pep8 bad

#

120 cpl minimum

heavy knot
#

i know.

#

i'm asking if pycharm can auto-format to fix those

#

cuz it misses some things that flake8 catches

thin crescent
#

how can i persist a sqlite db with docker?

#

i have found volumes

#

and that seems to be the way to go

#

but how to use them is eluding me

#

docker run -v ~/database:/app/bot f7676b536427

#

this is what im kinda trying and its not wanting to wokr

finite fulcrum
#

Pycharm should deal with all of those except multiple statements on one line with its reformat options

#

Well, depends on how those statements look but you shouldn't write that in the first place

wooden ibex
#

@thin crescent don't use relative paths like that

#

use absolute

thin crescent
#

Absolute paths in the container?

wooden ibex
#

~/this/is/bad

#

~ which home are you referring to?

#

/app/this/is/good

thin crescent
#

If i do /app it says it can’t find main hmm

#

Cuz I’m running the bot package with -m

wooden ibex
#

J, I'm talking in general

#

~/database <--- bad, doesn't matter host/container

#

in container, I'd move database into something no where you place python file

#

like put python app into /app on container and /database which is volume mount point

#

or /app/database is fine but make sure nothing goes in there but sqlite file

ivory flax
#

is mypy not capable of understanding this??

try:
    import ujson as json
except ImportError:
    import json```
```sh
mypy test.py
test.py:4: error: Name 'json' already defined (by an import)
Found 1 error in 1 file (checked 1 source file)```
wooden ibex
#

Why?

#

Don't do this

ivory flax
#

Its not my code, but why is mypy returning an error here? Its obviously not a redefinition. Could this be a bug?

thin crescent
#

What exactly is app in docker

#

Cuz it there but i never really understood what it means

wooden ibex
#

I'm talking your application

#

/app is just a directory

thin crescent
#

Is /app where docker puts my program?

#

My project structure is ClemBot/bot/

#

So would a relative path to the main be /app/ClemBot/bot ?

twin hull
#

@wooden ibex This is commonly seen in librairies that need to support different versions of python

analog kettle
#

I'm trying to understand how the perpetual fallback license works for PyCharm. Is there any kind of penalty to prevent you from having a month-to-month subscription, but cancelling each time and renewing every time there's a release that you want?

#

Other than the fact that you only get the PFL if you pay for a whole year up front or pay for 12 consecutive months.

thin crescent
#

hmm i tried using relative paths and docker shouted at me

#
See 'docker run --help'.```
thin crescent
#

ok im doing this now

#

and it runs but it wont create the sqlite file

#

i have this at root

#

and i wnat to have the bot write to database

#

this is the structure i have in the Clembot folder

heavy knot
#

applications running in docker can't directly access your drive

#

oh wait that's a bind mount I'm blind

wooden ibex
#

J and it's not working?

heavy knot
#

@J it's not something I can easily solve, didn't look at docker in a while. But you may find this reference page helpful https://docs.docker.com/storage/volumes/

wooden ibex
#

isn't -v volumes

heavy knot
#

yep, the way it's used here is a bind mount if I'm not mistaken

wooden ibex
#

yep, you are right

#

I hate both and don't use either so I'm going off old memory when dealing with docker and volumes/bind mounts

heavy knot
#

Same

#

Storage management was the main reason I stopped bothering with docker

wooden ibex
#

I just stopped doing things that require file storage

#

databases go into cloud databases, files go into S3

heavy knot
#

stumbled into a nasty bug that caused my db to corrupt

#

it was an issue with some volume driver, took me ages to even figure out the cause

wooden ibex
#

yea, I strongly dislike databases in docker, like this is bad idea, please stop

heavy knot
#

when it actually works it's fine

#

wouldn't use this setup for production

wooden ibex
#

sure but whole point of containers was "This is disposable cattle" and database servers are rarely cattle

heavy knot
#

I see docker as a tool to spin up local test environments

wooden ibex
#

sure, for dev/testing, fine

#

I'm talking production

heavy knot
#

and when it works it makes deployment a bit easier, but then there's other tools that are better for production

wooden ibex
#

I use it for Prod and it works great but again, my database is Azure CosmosDB and few files are stored on Blob Storage

#

so containers themselves are stateless

lime star
#

Hey, Im trying to edit my xterm window but I cant get the font to change from the default, also it appears that whatever I merge stays in the xrdb, even if I delete that line in the Xresources, how can I change that

heavy knot
#

Its grayed our

gray eagle
#

Reinstall 😄

heavy knot
#

Out

#

No

#

Lol

gray eagle
#

Wym you can't select anything?

heavy knot
#

I can't click run without debugging

#

What type project do I need to do to make plain python file on vs

gray eagle
#

Looks like you have nothing to debug..

#

Idk what to tell ya man. Idk what that problem is.

heavy knot
#

Wsit

#

Wait

#

What type project type do I select for plain python file

gray eagle
#

Is that pycharm or something?

heavy knot
#

Whenever I start my program I must press key 2 times for it to print what I say. Help

proper dawn
tawny temple
#

It's odd that the imports are actually correct. Not really familiar with pylint, but I have a general suggestion. pylint may be getting tripped up because of the current working directory used when running the linter. Cause pylint is using a wrong directory, it may not realise/see the "bot" package.

#

Also, I disagree with the comment that states using relative imports is the "python way". Absolute imports are totally fine.

final furnace
white grove
#

Hey guys, using PuTTy I keep getting this error - and im not sure why?

tranquil creek
#

maybe you put the host you're connecting to in the wrong field in putty?

white grove
#

it's local as of now

#

just the direct filename

tawdry needle
#

what do you mean "direct filename"?

#

it looks like you're trying to connect to a server called "C"

stiff burrow
#

can anyone help me with gits and commits
Now I'm using plugin called Git history diff to see my changes in commit
but i wanna delete this plugin/extention in vscode and code in git
and I don't know what is this command
I have tried "git diff" to see but it only shows the changes between two commits
And I'm not that comfotable with it
Any idea ?

#

if found anything just easily ping me

wooden ibex
#

Dead, you can't easily, that's whole point of git

#

@stiff burrow

#

you can delete history extension in VSCode but git stores history, it's not adding anything to git it's not doing naturally

quiet copper
#

I have a docker container which is running with the root user. How can I change it to run with a different user without recreating a new container (just want to modify the existing one)

#

I always find answers related to using docker run but as per my understanding that will create a new container and start it

cobalt gull
#

docker container need privileges to run in different context, namespaces and so

#

so you may have to do a lot of things to run as a regular user, and more, give this regular user so much rights that it'll be the same problem as running as root

wooden ibex
#

@quiet copper probably new container, containers should be disposable anyways

tender plank
#

uh... when i move like a project and open it with pycharm... how does one easily get all of fthe modules?
since it uses a venv?

wooden ibex
#

Requirements file

dire quartz
#

Does anybody happen to have experience with GCP metrics and alerts? I'm trying to create an alert policy and I have trouble interpreting what a particular trigger condition means.

#

I'm able to create a policy with a condition like "If a particular time series increases by X % for Y duration", and I'm just not sure I understand what that means. Would that imply that it triggers if the value increases by X % in a given Y period relative to the previous Y period?

dire quartz
wide solstice
#

Hi everyone. I have a OOM problem with k8s and python. I have 3 k8s nodes (the master and 2 workers). The principal node has 32GB of RAM while the workers have 700GB (in total). I have deployed an application written in Python with memory limit/request (2gb limit and 1gb request). The problem is that the containers that are running on the workers are constantly going in OOM and they are restarded (10 times per day) by k8s while the one on the smaller node is working perfectly. Has anyone ever seen something like this? Any idea? Thanks!

valid vigil
#

Hey guys idk if anyone has experience with Sublime Text but I was running a program and sublime text and the plugin host process start to eat up almost 100% cpu and the fans on my laptop started going crazy. I'm not sure what the problem is. The plugins I have installed are:

thin crescent
#

i posted this in a diff server and didnt get a response so ill repost here

#

i have very little docker experience so im sure its a very simple problem

finite fulcrum
#

I won't be able to help much but it'll probably be better if you just copied the message

thin crescent
#

is it not legible to yall?

finite fulcrum
#

images aren't exactly friendly because they need to be opened which limits writing and suck on phones

tawny temple
#

Try using an absolute path instead of a relative one

#

Our use a normal volume instead of a bind mount if you don't really care where the volume is on the host

thin crescent
#

i tried both of those

#

it ended up being a permission error on both a volume or a mount

#

so i cheated and ran it as root

#

not the best practice but im fed up with it atm 😁

earnest crescent
#

So i did this post because i have a problem , since 2 days i tried to install discord.py and i use all the command to install it but my code don't execute.

Traceback (most recent call last):
File "c:/Users/Cyril/Desktop/@Dev/pyDiscord/main.py", line 1, in <module>
import discord
ModuleNotFoundError: No module named 'discord'

I tried to install all the requirement and they are allinstall when i try all the command like : pip install discord.py or python -m pip install discord.py it send me thsi message for different things but the start of all the output are : Requirement already satisfied:

PS : My IDE is Visual Studio Code and my PIP is on the last version ( 20.1.1 ) and my python is on the version 3.8.3, i check with command : pip --version and python

Thanks for your help
And i try to install without VSC and with VSC

gleaming forge
#

do you have two python versions installed?

#

if so vsc may be using the other one

earnest crescent
#

Maybe

#

idk

gleaming forge
#

have a look at the

#

bottom left corner

#

of vsc

earnest crescent
gleaming forge
#

hmm ok must be another issue

barren spoke
#

@earnest crescent in a terminal, type py -0 to see all versions of Python you have installed. the 32-bit in your VSCode interpreter makes me think that might be an issue.

earnest crescent
#

Installed Pythons found by C:\WINDOWS\py.exe Launcher for Windows
-3.8-64 *
-3.8-32

barren spoke
#

yep. so, change the interpreter that VSCode is using to the 64-bit version. if you don't absolutely need it, i would also uninstall the 32-bit version.

earnest crescent
#

Ok , what command i need to do ?

barren spoke
#

for changing the version in VSCode, just click on that area that you took the screenshot of. it will then have a drop-down at the top to select the version.

for uninstalling the 32-bit version, same as any other program uninstall.

earnest crescent
#

I have this i took 64 bit

#

It looks like good*

barren spoke
#

yep. should work now.

earnest crescent
#

Ty very much !!!

barren spoke
#

yw!

white grove
#

I keep getting this error.

#

this is my code

mild lance
#

setting up sublime text for python, any package reccomendations?

mild lance
#

👍 Thanks :D

mild lance
#

Anyone know why my sidebar would have disappeared after closing and opening?

#

I opened the same folder, but the side bar never showed up.

tawny temple
#

It opens the side bar if a directory is opened, but not if a file is opened.

#

If you press ctrl k + ctrl +b then it will always keep it open

mild lance
#

Got it 😃

heavy knot
#

My Goal is to create a python program using selenium which will do certain automated task like taking the input from a text file, and fill up a php form online using the data on the text file, using headless chrome,etc.

I will be hosting this python program on my linux vps.

And, I want to create a php account registeration page, so every new user who will register will get a different account,
and there he have to fill certain data like name,number,address which will be saved in a text file.
and will trigger the python script to run on clicking the submit button.

My Doubt it If two or more user are accessing their account, filled the data, and clicked on submit button.
Does this will create python program instances for each of them or same python program will run for all of them ?

If same program will run then, the python program will do 1 work at a time thus the process of other users will halt.

graceful patio
#

It's basically saying that the repo on GitHub is more recently modified than your local one

#

So it doesn't really want to upload the changes because as far as it can tell the GitHub one is the newer version

mild lance
#

It's basically saying that the repo on GitHub is more recently modified than your local one
@graceful patio You are reading from #user-interfaces, right?

graceful patio
#

Yep :D

mild lance
#

:D

#

I'm setting up the github repo for the "DrawfFortressStyleGeographyToAscii" project

graceful patio
#

Ahh :D

#

I was having a look at mapping sources for that

#

My working title has been term-gjs

#

Gis

mild lance
#

👍

#

Do you know how I would fix the push problem?

graceful patio
#

So I think it's pretty simple cause you encounter it often

#

I think you could just modify the local files again then git pull maybe?

#

Or manually upload the current files to GitHub, then clone the repo to local which is what I normally do

tawny temple
#

I would fix it with git fetch origin; git rebase origin/master

#

That will pull the remote changes then apply your local changes on top.

mild lance
#

I would fix it with git fetch origin; git rebase origin/master
@tawny temple That fixed it! (im not exactly sure how.., but it did)

#

😄

tawny temple
#

Did my explanation not make sense?

#

As seagull wrote, the problem was that your local branch was out of sync with the remote. So locally you had some commits that the remote was missing, and the remote had some commits that you were missing.

#

Think of a rebase like this: it temporarily stashes away your commits, then pulls the commits from the remote, then takes your local commits out of the stash and re-applies them on top of what you just pulled.

#

I don't know if it actually uses a stash (there's literally a git feature named that), but that's not relevant to the point

mild lance
#

Ah, that makes sense 👍 thanks :D

mild lance
#

This would just be git pull, right?

tawny temple
#

No. What this question implies is that the commits have other changes that they don't want to pull. They only want to pull that one file's changes.

#

I don't think that's possible, but maybe it is with some trickery. I don't feel like git is really designed that way though.

#

If all the file's changes are within one commit, then it is possible to like rebase and drop other commits (or the same thing in some simpler way)

mild lance
#

Ah, okay

tawny temple
#

Either way, you're basically breaking the history by doing this

mild lance
#

About rebasing, I looked at something that was about the rebasing workflow. So, while on one branch they did git rebase master which moved all of there changes up to where the newer commits had been made and then switched to the master branch and did git rebase feature which took all of the commits on that branch and moved them to the master branch, am I understanding that right?

tawny temple
#

Yes, but you need to be careful about rebasing to master

#

If the branch you're rebasing isn't up to date with master already (which is what the first rebase did), then the commits will be placed somewhere in between master's commits. This is a problem cause it will re-write the history.

#

Which isn't something you want to do on master cause that's like the main branch everyone uses

#

Of course, git will prevent you from pushing if this happens. You'd have to force a push with git push -f

mild lance
#

The reason that they would have done git rebase master was so that when they did the git rebase feature everything could be "in line", so it was:

#

Ah, sorry have to look at what you wrote

#

If the branch you're rebasing isn't up to date with master already (which is what the first rebase did), then the commits will be placed somewhere in between master's commits. This is a problem cause it will re-write the history.
@tawny temple Ah, thanks that was my main question

tawny temple
#

Actually, that may be a bit confusing

mild lance
#

Yeah, I wasn't sure how git rebase feature would add the commits, while git rebase master just moved them up

tawny temple
#

Doing a merge instead of a rebase also places the commits in-between (i.e. in sequential order), but it doesn't rewrite the history. Instead, it adds a merge commit which is at the top i.e. the HEAD

#

With a rebase, the commits that are applied after have different hashes than their original counterparts. Hence re-written history. Hope that isn't too confusing

#

Like lets say master has A B C D commits, and feature has 1 2 as commits. Feature only has A B from master, so when you do git rebase feature, you will get A B 1 2 C D, and C D will have different hashes.

mild lance
#

I don't think I know what hashes mean in this scenario

tawny temple
#

It's the ID of the commit. I'm just trying to say that as far as git is concerned, they are different commits than the original C and D

mild lance
#

Why does the ID change?

#

Also, I was wondering how the example from above would with merging? Are there the same caveats?

#

Where you have to worry about "re-writing" history in a sense because now commits are "being added to history"

tawny temple
#

I'm not sure I really know. I'm not well versed on the innards of git. Maybe a simple explanation is that when you rebase, it could possibly change the diffs of the commits applied on top. So, even if it doesn't change their diffs, they still get new IDs. But I think this is something someone else will have to answer for you.

#

Merging doesn't ever re-write history.

#

Instead, it creates a new "merge commit" which is meant to reconcile any conflicts between the two branches.

#

Where as in a rebase, the reconciliation would be done in the commits themselves rather than in a new commit. This is what i meant by "rebase could possible change the diffs"

mild lance
#

So, for the example above:

If the master has A B C D , and feature has 1 2 which only has A B, then when you merge, what would happen?

tawny temple
#

A B 1 2 C D MERGE_COMMIT

#

Where all the commits have the same "ids" as before.

mild lance
#

Okay, let me make some pictures and check to see if I understand

#

So, saying that we start with this:

#

A merge - git merge feature, will turn it into this:

#

Where, as a rebase - git rebase feature - will turn it into this:

#

I think that is the easier bits?

#

And then, now if we look at where the person developing the branch does not up to date with the master

tawny temple
#

I'm hesitant to comment on those graphs cause I am not sure how to properly interpret them

mild lance
#

Would it be better if I explained the meaning of the circles and such?

tawny temple
#

Your rebase image has two extra circles. Not sure where those commits came from

#

If we're assuming the same commits on both the merge and rebase (excluding the merge commit)

mild lance
#

Ah, I from the video I had seen, they said that a rebase "shifted the commits to the master branch"

tawny temple
#

Might be even better to start here

#

Cause the first link is mainly about rebasing, not merging

#

Alternatively, you could just create a repo locally to play around with. Create some branches and some commits in each, then try to merge or rebase them and observe the logs

mild lance
#

Ah, will do, those look helpful

tawny temple
#

Good reads

mild lance
#

The one you just sent seems like the one I'll go with 👍

#

The pictures are so nice

mild lance
#

For the question about why the ids were different:

This moves the entire feature branch to begin on the tip of the master branch, effectively incorporating all of the new commits in master. But, instead of using a merge commit, rebasing re-writes the project history by creating brand new commits for each commit in the original branch.

#

So, assuming that the "original" branch is the feature branch, it moves all of them by re-writing the commits rather than moving them, I think

wooden ibex
#

BTW, it depends on organization what people use

#

my company, if you have pushed your branch, you must merge

mild lance
#

I think I get the advantages of rebasing now: when you do it, your branch just get's slid up to where the master branch currently is, meaning that you don't keep needing merge commits in order to keep up with the master branch, you can just keep "moving up the tree"

wooden ibex
#

downside is you lose history

mild lance
#

I still don't really get that part, what history do you lose?

wooden ibex
#

any history from that branch

#

like looking at python-discord bot

#

they merge

mild lance
#

Ah, so the history where you can actually see the branch, and what was being developed on the main branch/other branches while that happened

wooden ibex
#

some people are rebasing before merge

#

yep

#

we merge with history intact

tawny temple
#

Do you mean you lose the history for the merge commit, so you can't see what exactly needed to be done to resolve conflicts?

#

Cause otherwise IDK what you mean by losing history

#

When i think of losing history I think of squashing typically

fresh magnet
#

Hey I'm looking into Fabric to automate server deployment

#

Looking at old docs I see that you could set host lists e.g groups of hosts. http://www.fabfile.org/upgrading.html#host-list

creating explicit fabric.connection.Connection and/or fabric.group.Group objects as needed; core Fabric is in the process of building convenience helpers on top of this

#

Any idea if these helpers have ever come to fruition?

tepid ridge
#

Hey guys, I'm using a Digital Ocean droplet for a project. Whenever I try to apply cloud firewall rules to the droplet, suddenly CPU spikes to 80%, and internet connections to and from the droplet cut out intermittently. The droplet image is ubuntu-docker, and I'm only applying basic firewall rules such as allowing inbound SSH, and allowing all TCP/UDP outbound connections. Any ideas on what's causing this?

#

My guess is that the cloud firewall is somehow screwing up docker, since docker can normally bypass UFW, but probably not the cloud firewall. However, I don't know for sure, and even if this is the problem, I don't know the solution.

fierce locust
#

Hello guys

junior breach
#

hi

#

where do i go with a beginner/noob question?

thorny shell
#

unless the question is about a "tool" like git or something, in which case here is fine

rancid schoonerBOT
#

Hey @naive torrent!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

mild lance
#

Anyone know of a package for sublime text that will basically just show if a file has not been committed yet?

Maybe the file looks like this if it has been committed:

#

That's not the best picture, but something like that.

mild lance
#

Ah, it seems that that is actually built in :D

stable rose
#

I’m having something of a devops issue with tox. Here is my tox.ini

envlist = py37, py7-integ
skipsdist = True


[testenv:py37]
install_command = pip install {opts} {packages}

deps =
    -rrequirements.txt

setenv =
      PYTHONPATH=.
    GOOGLE_APPLICATION_CREDENTIALS=test.json

commands =
    pip3 install dash[testing]
    pytest --driver Chrome --cov=dash_app tests/


[testenv:py37-integ]
install_command = pip install {opts} {packages}

deps =
    -rrequirements.txt

passenv = *

setenv =
      PYTHONPATH=.
    GOOGLE_APPLICATION_CREDENTIALS=test.json

commands =
    pip3 install dash[testing]
    pytest --cov=dash_app tests/ --driver Chrome --driver-path $CHROMEWEBDRIVER```
#

I use py37 for local testing, and installed the chrome driver using brew cask install on mac. Everything works peachy there. (edited)

#

I’m using azure pipelines for continuous integration and testing. I use py37-integ for that.

#

When I do echo $CHROMEWEBDRIVER on my pipeline, I get back /usr/local/share/chrome_driver

#

but when tox runs in the pipeline, I get an error that has to do with it not finding the webdriver

#

2020-06-14 20:02:42,937 [ERROR] dash.testing.browser (get_webdriver, line 374): <<<Webdriver not initialized correctly>>>

#

Any ideas on how to proceed?

tawdry needle
#

does tox clear or mess with PATH?

#

or other environment variables

#

what if you manually setenv it

topaz aspen
#

How on earth does committing sub sections of a file work in vscode?

I have tried using git stage selected ranges, where I have highlighted something.... but when I come to commit there's nothing there to commit?

vital dawn
#

Hi Guys,

I am facing an issue to deploy django project.

I compiled all project files to .pyc, but i am unable to start the server with Gunicorn.

ExecStart=<venv_path>gunicorn --workers 3 --bind unix:/<application_path>.sock <application_path>.wsgi:application

Can i use .pyc with Gunicorn?

tawdry needle
#

usually you dont need to manually create pyc files ever

#

what is the error you get from gunicorn

gentle forum
#

Do any of you use sublime text? And if so, what do you use as a debugger? ipdb? sublimedebugger?

heavy knot
#

How do I make a program check user input for an integer in an if statement?

vital dawn
#

@tawdry needle i did create pyc files manually, and then gave path to .wsgi of django application.

#

What is the best way to ship a django project? where code is not readable.

tawdry needle
#

It's pretty trivial to decompile those

#

You were trying to ship a Django server application, but prevent the code from being readable? Seems like an odd thing to want

#

Also what do you mean by "application path"

#

You can't use full file names with slashes in python as module names

#

What you're trying to do might actually work, but you need to be more specific about how you set things up

#

Also keep in mind that pyc files are not portable across python versions or operating systems

finite fulcrum
#

Does OS matter? The VM should act the same between them

#

But yeah pyc files aren't something that takes much from the code if it were to be reversed

wooden ibex
#

Yogesh don’t give Django app and host it on your servers

heavy knot
#

Hi, everyone. I'm using VS Code and I'm trying to add / remove interpreter paths that VS Code automatically detects so that I'm not using versions of Python that I've already deleted and can easily access versions of Python that I have since installed. For instance, I recently downloaded Python 3.7.7, but I can't use that version unless I manually type in its interpreter path, which I want to get automatically; additionally, the interpreter path detects Python 2.7.16 on my system, even though I deleted the files to 2.7.16 a long time ago and haven't used it since.

#

Is there any way I can manually add or remove interpreter paths so that I can switch between them more easily than manually typing in the interpreter paths myself? The fastest way I've found to do it is to copy-paste the directory for the versions of Python I want to use into the interpreter path search, but it still isn't as efficient as I would want.

native umbra
#

Try the whole uninstaller thingy they got on windows if that's what you're using

heavy knot
#

@native umbra Will that uninstall VS Code without uninstalling Python and the dependencies I have installed?

native umbra
#

The add or remove programs thing?

#

you just want python 2.7.16 gone in entirety right?

heavy knot
#

@native umbra No, I also want Python 3.7.7 to be added to the list of interpreter paths it gives me automatically when I try using a new interpreter.

native umbra
#

Is this a Conda enviroment?

heavy knot
#

I don't think so.

white grove
#

how can i test if my bot works by running it locally?

#

(discord bot)

wooden ibex
#

run it locally and chat to it in a server

unkempt plaza
#

So im attempting to use docker so that I can develop a discord bot with a db. I am pretty new to Docker but have been able to throw this together (https://paste.pythondiscord.com/edoqijibug.py) But I want to be able to have the code update within the container when I edit the code on my host machine. Is there a better way to achieve this than rebuilding?

vital dawn
#

@tawdry needle @finite fulcrum @wooden ibex Thanks guys for your valuable suggestions, I have to probably go with normal gunicorn, nginx deployment.

tawny temple
#

@unkempt plaza If you create a bind mount for the directory with your bot's source code, then you shouldn't need to rebuild the image when you're using Docker Compose. You'd just need to restart the bot, which can be done by restarting the bot service via docker-compose restart bot. A rebuild would only be required if you changed packages in requirements.txt.

#

By the way, you don't need to run your bot in Docker in order to access the DB. You could still run the bot on the host and just expose the DB container's port to the host so that the bot can connect to it.

rose halo
#

Hi, I have created a virtual environment using Pipenv, but when I try to pipenv install sqlite3 I get an error ERROR: Could not find a version that satisfies the requirement sqlite3 (from -r c:\users\X\appdata\local\temp\pipenv-1wf9lnf1-requirements\pipenv-iabquvct-requirement.txt (line 1)) (from versions: none) ERROR: No matching distribution found for sqlite3 (from -r c:\users\X\appdata\local\temp\pipenv-1wf9lnf1-requirements\pipenv-iabquvct-requirement.txt (line 1)) I don't get the error for other packages.

#

Wait sqlite3 might be in the standard library

finite fulcrum
#

Sqlite3 is not a pypi package and needs to be installed with python

#

If it didn't come with python then there are other ways of getting it, like with tkinter

rose halo
#

Looks like I already have sqlite3 😅 Nevermind..

unkempt plaza
#

Didn't think of running just the DB in the container. That's smart. Thanks for the tips!

ocean canyon
#

Any idea why when I do a python setup to make a universal build it's adding files that I have deleted? These are files such as init.py causing it to include all the files in the subdirectory to spite my setupy only specifying one of them. Any thoughts?

tawdry needle
#

@ocean canyon you are using setuptools/setup.py?

#

does it only happen with universal builds?

ocean canyon
#

I ran a clear cache on the setup.py --all and I think that worked.

#

So weird it just keeps taking older files till cache is cleared

tawdry needle
#

interesting

#

good thing it worked and good to know

ocean canyon
#

Yea my model files were over the pypi 60mb limit so I had to restructure to pill down after install.

tawdry needle
#

have you considered distributing the model separately

#

like how nltk makes you download data files

west sluice
#

I have (non-administrative) access to a linux server where python is managed by conda

#

Is there a way I can get pipenv to work on that server somehow?

#

Right now the virtualenv command doesn't even exist

ocean canyon
#

like how nltk makes you download data files
@tawdry needle Yes, I moved it into my gdrive with open sharing, and just have the model download as the library is loaded.

tawdry needle
#

@west sluice usually modern python installations use the built-in venv

#

you should be able to pip install pipenv in the base conda env

#

or create a separate conda env for pipenv-based projects

#

does anyone know why Git for Windows would hang indefinitely upon trying to clone a repository? i'm trying to debug this issue for a coworker and having no luck

#

i cannot reproduce on my machine

west sluice
#

@tawdry needle what's the difference between venv and virtualenv?

#

I've never used venv before

tawdry needle
#

one is third party, the other comes with python

#

ive only really used venv

tawny temple
#

I find venv to be adequate.

steep glen
#

hey guys, i have a question with git, hoping for some small guidance, i rebased my repo's branch to my master, do i submit a separate PR now? previously i was submitting all changes from my branch to the branch made for my changes on the original repo.

hope this makes sense

tawny temple
#

Sorry, I couldn't understand. Can you try rephrasing?

steep glen
#

so my buddy made a branch for me to add a feature and cloned the repo, i made a bunch of commits to that repo and we would give me feedback and now i want to rebase it so that it doesnt enter as a bunch of commits. I rebased the branch to my own repos master. not sure what to do now

tawny temple
#

What do you mean by "so that it doesn't enter as a bunch of commits"?

#

Did you want to squash your commits into 1?

rich nebula
#

that's what it sounds like

#

rebase is 100% not what you wanted

tawny temple
#

Well, you can squash via an interactive rebase. Just trying to get a clear picture of what's going on.

steep glen
#

Yeah, I was using fix up to quash

tawdry needle
#

you could also consider: why do i want to avoid showing "a bunch of commits"?

steep glen
#

Idk, he asked me to

tawny temple
#

After you've squashed all you need to do is open a PR.

tawdry needle
#

^

steep glen
#

New PR right

tawny temple
#

Do you already have an existing open PR?

steep glen
#

Yeah

tawny temple
#

Is it the same branch?

steep glen
#

Yes, but I rebased onto master

#

Branch I worked on has 11 commits, master has 2

wooden ibex
tawny temple
#

If your PR still is using the same branch then there's no reason to make a new PR

#

Assuming you are on GitHub, you could have saved yourself some hassle by selecting "squash and merge" when merging the PR on GitHub

wooden ibex
#

people don't like merge because it's more difficult to track a repo with a ton of different branches

#

but downside is you can't see the work in that branch after the merge if you delete the branch

tawny temple
#

It's unclear what your collaborator wants you to do.

#

But have a read on that page

wooden ibex
#

I feel rebasing has worst of both worlds

#

you get all the commits and you don't know exactly where they came in

tawny temple
#

That wouldn't be a problem in a perfect world where every commit is atomic and has descriptive messages

wooden ibex
white grove
#

run it locally and chat to it in a server
@wooden ibex yeah, that's what im asking

#

i don't know how lol

jaunty gyro
#

hei guys do you know if there is a github discord out there ?
I am new to github and I wanted to ask you how i can merge an existing repostery to another axisting repostery ?
I would be realy thankfull if you could help me. Thank you

#

thanks guys

white grove
#

how can i host a bot locally temporarily to check if it works on a discord server?

tawdry needle
#

@white grove you can just run it from your computer

white grove
#

Yeah, how?

#

It won't run

tawdry needle
#

then you probably have it set up wrong

#

how are you running it?

white grove
#

I'm just running the python script

tawdry needle
#

what does "won't run" mean

white grove
#

It just closes whenever i run it

#

when i run it through cmd it doesn't give a response

#

@tawdry needle

tawdry needle
#

nothing at all?

#

thats odd

#

share your code

#

!paste

rancid schoonerBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

white grove
#

@tawdry needle

tawdry needle
#

so if i download this file, and run it with python on the command line, you're telling me nothing at all is going to happen, and it will exit with status 0?

#

i find that hard to believe

#

it looks like a correct, minimal discord bot

white grove
#

i opened cmd

#

and

#

this happens

tawdry needle
#

huh.

#

oh

#

wait... no. huh

#

im probably missing something. at least the code is posted and someone else can look

white grove
#

Oh, okay

#

I came here before to ask about using puTTy

#

thanks for looking 😄

heavy knot
#

Hi, I have a cuestion, when I try to use a module called mcstatus it constantly shows me this: no module named mcstatus, and I have it installed

rich nebula
#

you're probably using the wrong interpreter

steep glen
#

is there a way to delete a commit after i pushed it to github already?

#

i made a typo

thorny shell
#

you might be able to remotely delete the branch, but that's super-dangerous

#

if it's just a typo, fix it with a new commit, and get on with your life

#

you could also "squash" the new commit into the old one, then "force push"

#

your repo may or may not allow that

steep glen
#

thanks

violet hatch
#

use git commit --amend, and then git push --force-with-lease

knotty frigate
iron dock
#

does anyone know why atom always opens with 2 blank files atom and ATOM_DISABLE_SHELLING_OUT_FOR_ENVIROMENT=false.
literally everything i have tried still opens those two (except for starting from cmd with atom --clear-window-state

#

please @ me if you have a solution or something you'd like me to try, i don't frequent this channel much

barren spoke
#

@iron dock this actually just started happening to me a couple days ago. i thought it was related to installing the linter packages. but that didn't fix it for me. only other thing i can think of is an OS update caused something (i'm on kubuntu 18.04)

#

finally took some time to look into the issue...
found a thread that states its a regression: https://discuss.atom.io/t/problem-on-atom-startup/75724

iron dock
#

im on ubuntu 20.04

#

seems like its an issue with installing from sanp

barren spoke
#

not sure. the workaround linked in that thread doesn't work for me...

#

i might just start over and go the apt route, now that its available. i think snap was the only way when i first started using it.

iron dock
#

snap didn't work for me

#

installing via apt did work for me

#

@barren spoke

#

if you want to fix it

barren spoke
#

cool. might do it tomorrow. i'm winding down for the night... 😄

heavy knot
#

found a pycharm plugin

#

type :, hit ctrl+space to trigger code completion and boom

#

no more \:emoji: in discord to get unicode :D

heavy knot
#

@heavy knot

#

this is the code

#

and what abt +str?

#

k 1 sec

#

ye

#

i get this again

#

ohh

#

stntaxerror

#

syntaxeroor

#

time.sleep is wrong

tawdry needle
#

can you just post the code as text? are you not able to access discord on that computer?

#

its really hard for many people to see that

heavy knot
#

yes

#

cuz it worked before

#

just now it doesnt

#

since i did ())

#

it works but now i got this

#

i got error in console

#

ye i do

#

wait

#

i see

tawdry needle
#

BeautifulSoup not Beautifulsoup

heavy knot
#

ye

#

another error

#

lmao

#

yiu told me to put that in so idk

#

sorry im just a beginner

#

ye

#

the item that im scraping you mean?

#

ye

#

thanks for help tho

vital epoch
#

hi folks. I'm looking into tox for the first time for my project, coming from a background usually just working virtualenv and a requirements.txt. I'm curious about the right way to set this up in my – I totally understand how to configure the different envs in the tox config file and how to run them etc, but how do I version lock tox itself?

#

What if I'm using tox vX.Y.Z and my teammate is using tox vY.X.Z?

tawdry needle
#

ive seen people have a requirements-dev.txt file

#

which lists the versions of all the things required in the dev environment

#

e.g. pytest, tox, mypy, sphinx, et al

vital epoch
#

that's dope

tawdry needle
#

that too, seems like you can use both

vital epoch
#

👍 thanks

tribal forge
#

Any idea how to unstage a file with PyCharm?

vital epoch
#

hmm.. back again with more tox questions: what is envlist actually for?

#

I'm trying to configure my tox environments such taht everything always runs on python 3.7, which I thought was accomplished by putting envlist = py37 at the toplevel [tox] block, but that appears to be the wrong idea

vital epoch
#

ok so I think that toplevel envlist is meant to prescribe which environments to run, which for me is just envlist = test,lint

#

now I'm trying to understand how to provision a dev environment, but when I do that, it seems to ignore all the requires in my top-level [tox] block

left shuttle
#

if anyone has atom can they explain this when i download script, to run code

Installing “script@3.26.0” failed.Hide output…
events.js:174

      throw er; // Unhandled 'error' event
      ^


Error: ENOENT: no such file or directory, open 'C:\Users\domri\.atom\packages\script\node_modules\core-js\stage\0.js'

Emitted 'error' event at:

    at errorOrDestroy (internal/streams/destroy.js:107:12)

    at WriteStream.onerror (_stream_readable.js:734:7)

    at WriteStream.emit (events.js:198:13)

    at C:\Users\domri\AppData\Local\atom\app-1.48.0\resources\app\apm\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:303:14
    at C:\Users\domri\AppData\Local\atom\app-1.48.0\resources\app\apm\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:333:16
    at FSReqWrap.args [as oncomplete] (fs.js:140:20)
modest heron
tawdry needle
glacial pollen
#

Anyone here use atom

barren spoke
#

@glacial pollen yep. whats up?

glacial pollen
#

Whenever I run script the bot I made sends a message over once (depends on the times I run it) But if don't run it the edits aren't saved

barren spoke
#

i don't quite understand. what is the bot for? is it related to the edits aren't saved?

glacial pollen
#

Huh i

#

It's a discord bot

barren spoke
#

ok. and changes to your bot code aren't being saved in Atom, unless the bot is running?

glacial pollen
#

No no that's not what I meant

#

I meant that whenever I try to change the bot and to smake sure the changes are applied i neeed to re run the cript and when I do that every command repeats itself(ex. !ping, it'll reply like:pong, pong)

rotund beacon
#

To note, you can get python to work though it is pretty hard to set up

abstract sluice
#

do you really need to visualize all the keys you press? lol

#

dance dance ide revolution

short tusk
#

@rotund beacon IDE name

steep glen
#

when i contribute a branch from my fork to original branch, what should i do with my master?

lapis stag
#

how can I record how long a key was held down for. I tried messing around with the keyboard package, but I can't find a way to do it. Could I get some help with this? Any pointers?

true vapor
#

I'm not sure of the specific package, I'm sure there's a lot of different ones you could use, but the idea is pretty simple.

When a key is pressed, you save the current time in a variable. When the key is released, the difference would be equal to the current time minus that first time.

https://stackoverflow.com/questions/24072790/detect-key-press-in-python

pynput seems like a good choice for a package to use

lapis stag
#

alright Ill try to look into that. Thanks!

nocturne nova
#

how do i make an extension to run my interpreted coding language (made out of python) in vs code

mild lance
#

From the ubuntu terminal with ohmyzsh, is it necessary to put .exe at the end of the executables in the path? (I am using WSL 2 on Windows).
Because, when I did subl.exe <file> it works, but subl <file> doesn't work even though it does in the normal command prompt.

#

I'm not sure if that is it though because code <file> works without needing the .exe at the end

wooden ibex
#

Why would you do subl.exe on Linux?

mild lance
#

Well, it's technically not Linux, im using wsl 2 on windows, also, why wouldn't you need subl.exe on linux? @wooden ibex

wooden ibex
#

.exe isn't a thing on Linux

#

WSL 2 is Linux in VM

#

unless you are trying to execute Windows stuff via WSL in which case, please stop

mild lance
#

oh.. I had that that was the whole point of wsl 😅

mild lance
ivory flax
#

What are the options for migrating database in k8s?
I saw 2 options:

  • migrating db from CI (exposing DB endpoint and credentials to CI)
  • Using helm hooks to run a job before new version deployment (exposing cluster access to CI with helm (including DB credentials, seems even worse)

Dont quite like these, I dont host my own CI

mighty maple
#

To my macbook?

graceful patio
#

upload them to google drive then download them?

#

i don't really see how this is devops related

mighty maple
#

What

#

Will they work on macntos?

graceful patio
#

google drive?

#

have you not used google drive before

#

you just upload files and then you can download them again

mighty maple
#

I haven't used a mac before

graceful patio
#

right

#

but macs have a web browser

hearty copper
#

Let's say i want to pin the current packages I have installed in my venv:
./venv/bin/pip freeze > requirements.txt
./venv/bin/pipdeptree | grep -P '^\w+' | grep -v 'pkg-resources==' > requirements.in
./venv/bin/pip-compile --generate-hashes --verbose

Is this a correct solution?

mighty maple
#

@graceful patio ok how can I insert the windows file to the mac's Pycharm now?

graceful patio
#

what

#

i'm so confused

#

isn't this just a case of 'upload file, download file, open in IDE of choice'

mighty maple
#

The whole list.

graceful patio
#

right

#

have you downloaded it

mighty maple
#

I uploaded the scraches file

graceful patio
#

onto your mac

mighty maple
#

and downloaded it to my mac

#

Yes but how can I insert it inside pycharm

graceful patio
#

just open it in pycharm

#

the folder

late briar
#

im using atom.io and was wondering the fold feature, can i make a fold without using if/elif/else/while

tribal forge
#

@late briar does it not fold functions?

late briar
#

It does but there is a big section that I would like to fold so it’s neater

mint heart
#

how can I show print statements in a fuctions in tkinter gui?

late briar
#

could you send an example

#

@mint heart

#

and explain what you are trinna do

#

so your trynna add text to a tkinter QUI

mint heart
#

def sum(a,b):

print(a)
print(b)

return a+b

sum(a,b)

Label(root,text=sum(5,6))

Like here we have a print statements. How can I show these print statements in GUI

late briar
#

so your trynna add text to a tkinter GUI

mint heart
#

its a button when I will click on the button I want to know what is happening behind so I have introduced print statements. and I want them to show in GUI

late briar
#

what

mint heart
#

I want to show print statements in gui

late briar
#

so u want it to say "print ("bla bla bla")"

mint heart
#

yeah

late briar
#

import tkinter as tk

root = tk.Tk()
T = tk.Text(root, height=2, width=30)
T.pack()
T.insert(tk.END, "Just a text Widget\nin two lines\n")
tk.mainloop()

#

that what u looking for

mint heart
#

will try @late briar

#

Can we introduce python console in GUI ?

quartz plank
#

Hello all. If I'm using poetry for a project, how can I add a script to my path such that it can be run from anywhere and excecute in the virtual environment poetry created for it? I'd rather not install it and all its dependencies to my system python. My current solution is a bash script that changes the working directory to the project directory, but that has some disadvantages

tawdry needle
#

@quartz plank try

[tool.poetry.scripts]
my-script = "my_library.__main__:cli"
#

or something like that

#

ah wait thats the wrong feature

#

1 sec

#

yeah i think

#

try that

quartz plank
#

@tawdry needle thanks for the suggestion. I have already done that, but to run "my-script" I need to be in the project directory and then I can run it with "poetry run my-script". I want to be able to run it from anywhere in the filesystem. Even if I add the project directory to the path, poetry only seems to look in the current directory and its parent for a pyproject.toml

tawdry needle
#

you need to pip install it

#

or pip install --user

#
pip install --user /path/to/my/project
#

or pipx install ideally

quartz plank
#

ah ok, I was hoping to avoid that but if it's the only way I will do it

#

oh what's pipx I'm not familiar with that?

#

nvm I looked it up, sounds ideal. thanks for your help!

tawdry needle
#

👍

merry pasture
#

someone help me make a key detection system for the dji tello drone go ahead with w go back with s
and go sideways with a and d

zealous sierra
#

I need help with "installing" python... I have it installed but on Pycharm it says its not in the correct folder... How would I be able to change where pycharm looks for Python?

tawny temple
#

This documentation covers most of it

#

Also note that each run configuration in PyCharm can also have its own interpreter.

#

But, by default, it should be set to "Project Default", which means it will use whatever interpreter you set for the project as shown in the link I sent.

zealous sierra
#

I reset my device (keep personal files) so the "Project Default" was deleted but the other files were not

#

I wonder if making a new project and copying the code over would work better

#

That wont work cause this is what happens when I create a new project

#

Ping me if you know how to fix that

thin crescent
#

@pearl phoenix Yep i have CD

heavy knot
#

J

#

If repl catches u hosting a bot on their website, would they ban or ip ban u

pearl phoenix
#

so cd continuous development does what im hoping to do?

thin crescent
#

i mean theyll just turn it off

#

yee

#

i use github actions

cunning falcon
#

Shouldn’t matter. If you get banned you should not be able to join back

thin crescent
#

with a selfhosted runner on the EC2 instance

#

but theres tons of ways to do it

pearl phoenix
#

ahh that makes things much easier

#

lol

#

i was too lazy to look deep into it

thin crescent
#

aws has a thing called code deploy that is built for that

pearl phoenix
#

it was just a web server

heavy knot
#

I think ima just try and find out if my friend can host a bot on roblox studio which is probably impossible :/

pearl phoenix
#

i retired the website and just put a static terminated page in s3 now though

thin crescent
#

ya whenever i merge a PR into master the ec2 instance pulls the repo and builds a new docker container and deploys it with docker compose

#

takes about 3 seconds and the bots back up and running

cunning falcon
#

I think ima just try and find out if my friend can host a bot on roblox studio which is probably impossible :/
@heavy knot that’s probably not a good idea but you can try it

heavy knot
#

Ok

#

Lol

pearl phoenix
#

ah thats sweet

thin crescent
#

i also have a webhook in the bots server

pearl phoenix
#

i guess the main caveat for me regarding aws is that given how mature it is, theres a lot to look through to find what you are looking for

thin crescent
#

that updates the server when a new version is deployed

pearl phoenix
#

nice

thin crescent
#

ya, ill be honest. the CD took a LONG ass time

pearl phoenix
#

next time i host on aws ill use it

thin crescent
#

thats at least 100 hrs of work

#

github actions is pretty new

pearl phoenix
#

just for setting it up?

thin crescent
#

and theres not a lot of documentaiton on it

#

theres many many diff ways to do stuff i just chose actions cuz i liked the yaml approach in the repo

pearl phoenix
#

i feel like amazon just has a culture of doing so much so fast so it gets a little disorgniazed

#

they are more mature than other cloud computing platforms because they have a bias for action

#

but it kind reflect in that things are messy

#

*reflects

thin crescent
#

i mean AWS is the most used cloud platform in the world bar none

pearl phoenix
#

true

#

for many reasons

thin crescent
#

theres a 0% chance it cant do what you want

pearl phoenix
#

oh i am sure it can haha

#

basically what i mean to say is that one of their competitors might be a little leaner in terms of their offerings and it might make things easier

#

providing more direction towards documentation and making it easier to find things

#

also, i dont know about azure or google cloud, but it is no fun that there is no free technical support haha

thin crescent
#

also i dont know how the free tier works on those

cunning falcon
#

Isn’t google cloud gonna limit you?

thin crescent
#

AWS has a year of t2 micro

pearl phoenix
#

Isn’t google cloud gonna limit you?
@cunning falcon no idea lol. never used it

thin crescent
#

you can do 24/7 with on instance for free for a year

#

i couldnt find something like that for azure or cloud

pearl phoenix
#

you can do 24/7 with on instance for free for a year
@thin crescent yeah i used up my year

thin crescent
#

ahh rip

cunning falcon
#

I think the free tier only gives you x amount of time

pearl phoenix
#

azure has something similar

thin crescent
#

it gives 750 hours of compute time

#

and theres 730 hrs in a month

pearl phoenix
#

yeah exactly

cunning falcon
#

That’s not too bad