#tools-and-devops

1 messages · Page 35 of 1

lethal hemlock
#

I have created a new django project with pycharm and when I use the run server button (the green play button) my server runs fine

#

but if I use the terminal and access manage.py

#

I get this error:

#
ModuleNotFoundError: No module named 'fasgmc'
#

fasgmc is an old project that has no relation to this project

#

here is the file tree of the new projectL

#

settings.py and wsgi both have the correct project name wherever it would be needed

#

I assume this is a pycharm issue

#

and ran into similar things with flask

prisma nexus
#

r u using virtual environments? idk if that could be the problem but mb?

lethal hemlock
#

pyCharm created a new venv for this project

#

(at least that is what it is supposed to do)

#

I am trying to run manage.py from here:

(venv) C:\Users\domdi\PycharmProjects\BankInfozone>

#

the old project name does not show up anywhere in environment variables

prisma nexus
#

ok. and just to make sure. if u run which python (or windows equiv) does it source the right venv?

lethal hemlock
#
(venv) C:\Users\domdi\PycharmProjects\BankInfozone>python -V
Python 3.7.1

#

i am not sure how to do which on windows

#

I am looking now

#
(venv) C:\Users\domdi\PycharmProjects\BankInfozone>where python
C:\Users\domdi\PycharmProjects\BankInfozone\venv\Scripts\python.exe
C:\Users\domdi\AppData\Local\Programs\Python\Python37\python.exe

#

could it be due to the second instance of python?

#

I also changed the app name from "app" to "bankapp" in case it was getting confused with fasgmc's app folder

#

still

#

nothing

prisma nexus
#

are either of those executables the one that is used by the old project?

lethal hemlock
#

yes the second one...

#

so that is the culprit

#

any idea how to get rid of that in pycharm?

#

nevermind. the pycharm terminal has its own environment variables apparently

#

Goto File->settings -> Tools (v) -Terminal

#

edit the envvars

#

and u will see somehow there is a DJANGO_SETTINGS_MODULE in there

prisma nexus
#

cool :D so u got it working?

lethal hemlock
#

I got it working then decided to switch to flask because the smaller size of the project 😃 so a nice waste of time on a tuesday

prisma nexus
#

y'know... sometimes it be like that

#

not a huge waste though, you may run into it again in the future and now you know what to look for

plush tree
#

Never a waste! I'll bet you know more now than you did before :)

prisma nexus
#

^

sick kayak
#

hey so my vscode window freezes whenever it runs the linter, formatter or that kind of thing,
every time I save it creates a new python file named the same way except it has an hash between the name and the file extension, and deletes it when it's done doing its thing ( takes less than a second )
my file is 700 lines long, mostly made of functions that I don't use while I'm working on a new one,
I was wondering if the freezing was caused by the 12 import statements at the start of the file ( most unused ), or if it's just the file that is too big and has to be rechecked as a whole every time ?
here is my list of packages :

astroid                  2.2.5
attrs                    19.1.0
autopep8                 1.4.4
beautifulsoup4           4.7.1
CacheControl             0.12.5
cachetools               3.1.1
certifi                  2019.3.9
chardet                  3.0.4
Click                    7.0
grpcio                   1.21.1
httplib2                 0.13.0
idna                     2.8
isort                    4.3.20
lazy-object-proxy        1.4.1
lxml                     4.3.4
mccabe                   0.6.1
msgpack                  0.6.1
pdfminer.six             20181108
pip                      19.1.1
protobuf                 3.8.0
pyasn1                   0.4.5
pyasn1-modules           0.2.5
pycodestyle              2.5.0
pycryptodome             3.8.2
pylint                   2.3.1
pytz                     2019.1
requests                 2.22.0
rsa                      4.0
setuptools               40.8.0
six                      1.12.0
sortedcontainers         2.1.0
soupsieve                1.9.1
toml                     0.10.0
tqdm                     4.32.2
typed-ast                1.4.0
uritemplate              3.0.0
urllib3                  1.25.3
wheel                    0.33.4
wrapt                    1.11.```
I'm running Python 3.7.3 32bit on latest vscode with the microsoft Python extension
eternal flicker
#

hm, one way to debug would be to create a new file with just one function, then run it and see if you get the same issues

#

700 lines is quite a lot for a single file

sick kayak
#

yeah it gets worse with the more code I add and I don't have this problem with a 50 lines one

#

I have a few os.listdir(path) targetting like 20k files total in the functions I don't use, could be that too idk

sick kayak
#

yeah it comes from microsoft's python extension

prisma nexus
#

remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/AvianAnalyst/AvianAnalyst.github.io.git/'
I know i've entered the right informatin (and i've tired about four times) I think it might be because i've turned on 2fa? but idk how to account for that. Any help?

prisma nexus
#

ty

prisma nexus
#

Ok, so I got that set up (thank you again, ELA), and I'm trying to see how you can store it as an environmental variable and then use that. Do you guys write a push script that you run to push your changes to the remote, or am i missing something?

violet belfry
#

Usually you just want to use SSH

prisma nexus
#

ohh ok thank you!

lean shadow
vivid cargo
#

would you guys recommend installing docker on windows10

violet belfry
#

If you need docker, yes

vivid cargo
#

I would like to fiddle with it, some people told me that docker on windows is weird and messy

warped cliff
#

why dont VS code depug my py file ?
it was warking
only I do F5
now when I do F5 it doesnt run
help

tawny temple
#

@saki hyper-v has to be enabled. Docker may automatically do this for you. Problem is that enabling hyper-v makes VMs stop working. You could disable hyperv again of course but that requires a reboot every time you need to toggle it.

#

@vivid cargo I don't think that tagged you at first oops

#

For what it's worth I currently handle my docker needs inside a Linux VM

vivid cargo
#

Damn

#

I might as well buy another ssd for linux and start developing there

tawny temple
#

Really using a VM.for Linux is not bad

vivid cargo
#

What do you use for starting up vms

#

Vbox?

pure pulsar
#

it is kind of bad

#

VMs are such hogs, just switch to linux for dev and fall in love with it 😃

vivid cargo
#

I'm thinking about it since i'm running out of space on my ssd and i got a job starting in september

#

hype

tawny temple
#

I'm using VMware

#

I don't do anything performance intensive so the experience feels smooth for me

#

And with that said, I don't know if performance intensive tasks would be bad anyway

vivid cargo
#

I'm leaning more towards ssd

tawny temple
#

Not saying that's a bad thing

#

Just with a VM.you.won't need a new drive

vivid cargo
#

I know but i've only got 40 more gigs

pure pulsar
#

VM or no VM, if you had space, you could just partition the existing one and install linux there, no need of a new ssd if you had space, installing linux would take exactly as much space in a partition as in a VM

tawny temple
#

partitioning on windows is confusing to me

pure pulsar
#

you can do it through a live usb, but last time i had to reduce a partition from windows, it wasn't really as bad as before

vivid cargo
#

I have linux installed on my laptop, but it's very old

#

I am thinking about separate ssd just cuz i want to be able to transfer my workspace everywhere i go

tawdry needle
#

@vivid cargo thats not a bad idea, you can mount your work at /work or something on linux, and whatever the equivalent would be on windows

warped cliff
#

The Prob. is that my IDE debugger stops in the last 2 days

lavish cosmos
#

Which IDE?

warped cliff
#

VS code

#

when I press f5

#

it shows a frame that it starts

#

then it disappears

tawdry needle
#

@warped cliff i dont know the answer but its possible that you installed a new plugin or installed an update that broke a plugin

plush tree
#

There's a config file you may need to set first

turbid cipher
#

How to change the text color for Python in Hyper.js?

#

I mean, it would be like:
def is red
integers are blue
break is yellow etc

#

Like how it is on the Pycharm

hidden lily
#

When I install anaconda 3 on mac, why does every new terminal I open now have a (base) virtual environment?

tawdry needle
#

@hidden lily it looks like it's activating the base conda environment

#

how did you install it?

turbid cipher
#

@tawdry needle
I just download it
Gonna check these when i get the laptop, thanks

hidden lily
#

@tawdry needle with the official macOS installer package. And yes that’s what’s happening. But why? Is this normal behavior? What is it potentially messing up?

tawdry needle
#

@hidden lily i think its a little presumptuous on their part to include that in the installer

#

was it a "system wide" install or a "user" install?

#

im not familiar w/ the macos installer but i know how conda/anaconda works and i know how macos works

tawny temple
#

I would guess it added something to the bash profile file

#

to make it activate an env

#

just a guess though

hidden lily
#

@tawdry needle user install. Presumptive is a good word because before it was doing this, the Mac installer was overwriting the default “python” shortcut in the shell to its new version, even if that meant going from 2 to 3

tawdry needle
#

well it cant really do that

hidden lily
#

So I’m not sure who controls that or why they seem to love messing with systems

tawdry needle
#

it likely changed something in your ~/.bashrc file

hidden lily
#

It doesn’t uninstall it, no, but replaces where the shell finds Python

tawdry needle
#

yeah it cant do that as such

#

what it can do is add stuff to ~/.bash_profile or ~/.bashrc

#

can you open those files in a text editor and see?

#

it will say something about $PATH

#

or conda activate

hidden lily
#
# added by Anaconda3 2019.03 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/Users/kamuela/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/Users/kamuela/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/kamuela/anaconda3/etc/profile.d/conda.sh"
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/Users/kamuela/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda init <<<
#

Added to .profile

tawdry needle
#

just remove that stuff

#

i think you had to select an option to let it do that

manic minnow
#

anyone have a pycharm theme/color scheme that correctly mimics vscode? all the ones ive seen are garbage

pure pulsar
#

@manic minnow it's probably not hard to build one if you really know what you want

#

i mean, i didn't do any color theme for pycharm, but i did for vim and it's not hard, i imagine it would be not a lot more complex for any editor that didn't decide to make things awefuly complex for no reason

tawny temple
#

Yup it just takes some time. I made a visual studio theme for ida. That's was more involved since its assembly and didn't translate 1 to 1

white arrow
#

anyone know a good IDE for c++, python, webdev (html,css,php,js) or most of these languages in one? I don't want to download a bunch of IDE but maybe that's best what yall think? Please @ me if you respond.

delicate gorge
#

You see IDE usually means that its specialised in one language, you either cant get the other languages in or gotta download a bunch of plugins @white arrow

eternal flicker
#

if you want support for a lot of languages you don’t usually get the full features an IDE has to offer
for Python+webdev though VSCode comes to mind, but I’m not sure about how VSCode plays with C++

tawny temple
#

Visual Studio supports many languages. So does IntelliJ IDEA, but requires plugins

#

Neither will be "good" for all languages

vivid cargo
#

Everything by Microsoft plays well with c-family

exotic birch
#

This was the best place for me to ask, why isn't there a button on a GitHub page that leads to the releases. When I want to download a release I always type /releases behind the URL in the address bar

#

Or is there one?

eternal flicker
#

on the main repo page, do you see a horizontal section with a thin coloured bar below (that's the repo language composition btw) that shows the number of commits, number of branches, number of releases, number of contributors and license? it's below the description+tags, and above the repo file structure section

exotic birch
#

hol' up

#

How did I never see that

eternal flicker
#

unintuitive design? iunno :p

exotic birch
#

yeah, I guess

#

They don't really look like buttons

tawdry needle
#

github's UI really isn't good, we all just got used to it

pure pulsar
#

they purposely refrain from adding buttons and things to it, as there is so much you could add that you'd quickly make it illegible, some features are only available by editing the url directly

manic minnow
#

what it really needs is bitbucket style commit/pull diffs

pure pulsar
#

you can add .diff to a commit url to get that, or to a PR

#

well, not sure it's what you asked for, but it's a diff 😛

manic minnow
#

nah just the ui for the full list of changes is quite hard to see at a glance. you just get a sequential list of files instead of it being rendered as a directory tree

tawdry needle
#

how about, they actually give me a button for the compare UI, instead of me having to type /compare/foo...bar in the browser

#

or make it less than 1,000 keystrokes to view the tree at a commit hash and not by its branch/tag

#

thinking about self hosting gitea or something, idk. gitlab is too "industrial" feeling, its ridiculously feature-rich. the UI is really information dense

#

gitlab is kinda perfect for collaboration i guess. idk, the world needs the "one true bug tracker"

#

maybe launchpad. idk

tawny temple
#

Let's say you get into a situation where you push to a branch but later realise that upstream has had the same commits rebased (e.g. cause a previous PR of yours was accepted by rebasing) and now every commit of yours is different. How would you fix it? Right now I have been using this sort of clumsy approach: bash git format-patch hash git reset --hard origin/master git am -S --committer-date-is-author-date 000*.patch rm 000*.patch

#

I was thinking about an interactive rebase, where I'd break before my new commits start and do a reset there. That would be simpler if it works

vivid cargo
#

i want to ask you guys, do you recommend anything other than vi/vim based CLI editors

eternal flicker
#

nano?

vivid cargo
#

i've been trying to move away from nano

#

i've tried emacs and it sucks imo

delicate gorge
#

emacs and vim "suck" because the skill level required to make efficient use of them is quite high, if you actually know the editor you can do incredibly efficient things which might take you minutes or hours in a normal text editor @vivid cargo

vivid cargo
#

Not what i asked but okay

eternal flicker
#

Is anyone using PyCharm with pyenv? And if so, how do you setup the default project interpreter when creating a new project?

blissful sable
#

Is Visual Studio Code good?

tawdry needle
#

@eternal flicker are you using pyenv-virtualenv or just pyenv? in either case i think its a matter of selecting the right option and then navigating to the python executable

#

so File -> Settings -> Project -> Project Interpreter

#

then theres a little "gear" icon

vivid cargo
#

@blissful sable
One of best out there

pure pulsar
#

if you learn vim or emacs, you know you are set for the rest of your career, no need to learn a new one every 3 years or so

#

you'll spend the rest of your life fine-tuning your configuration though, and be unable to program on another dev's machine, and people won't be able to pair program with you on your own either

#

but it'll be great anyway

lost rock
#

correction: "you'll spend the rest of your life trying to exit vim"

vivid cargo
#

i was asking for some cli based editors, not persuasion to try vim again

pure pulsar
#

sorry, came in the middle of the conversation

sinful zinc
#

there's always nano

#

oh lol you mentioned you were moving away from that

#

well what don't you like about emacs

#

and for that matter what don't you like about nano

#

hard tyo make a recommendation without knowing what you're looking for

#

@vivid cargo

vivid cargo
#

I don't like emacs because it has weird keybinding that everyone loves

#

I just can't get used to it

#

I love nano but i want to try to move away from it and see if there are any other cli editors

#

I found micro

#

Seems okay

pure pulsar
#

Not everyone loves emacs bindings, and they can give you RSI… but you can use vim bindings in it with evil mode

vivid cargo
#

Even worse situation

pure pulsar
#

The ones it shares with readline are useful all other the place though, so worth learning

tawdry needle
#

I would love if somebody developed a new suite of emacs bindings

#

Vim bindings kind of suck too

#

And can be even worse with international keyboard layouts

vivid cargo
#

I completely agree

sinful zinc
#

i mean, in emacs the regular keys like arrows, home, end, holding shift for select (in gui mode anyway) work normally, and the other commands aren't really any more weird than most other text editors

#

i don't use it personally (too much into vim), but it really doesn't seem any harder than nano to use at the level of nano.

tawdry needle
#

thats true

#

you can safely ignore all the emacs stuff and basically just get nano

sinful zinc
#

i do want to learn more emacs some time

#

i'm in a kind of weird position with editors in that i like emacs better, but I'm better at using vim

tawdry needle
#

same. one day ill switch to evil

#

my big hangup with vim is that it really embraces the "composability" aspect

#

i hate in emacs how everything is its own command

#

forward-word, forward-character, etc

#

the whole idea of command+motion is really powerful to me

tawdry needle
#

@barren iron are you interested in a pretty website for your tool? one of those hip "2019 software" type of sites. i have a web dev friend looking for portfolio work

delicate gorge
#

He is more or less a webdev guy himself @tawdry needle

barren iron
#

Yeah @tawdry needle , I quite like doing everything myself.

#

Sharpops is going to take along time to get to the stage of needing a website

tawdry needle
#

👍

barren iron
#

@tawdry needle Does your friend happen to enjoy the design side more than the implementation side?

#

I'm currently building a portfolio of websites I build + host, would be happy to have someone to design for me

#

I have a few clients lined up

olive warren
#

Anyone else having memory issues after pycharm update?

#

Indexing takes hours...

tawdry needle
#

@barren iron yep design

barren iron
#

@tawdry needle Ok. if we both need experience... can I get in touch with him?

#

We can maybe share clients, double the portfolio

tawdry needle
#

yeah @barren iron let me get their best contact info

#

they have a discord acct but i dont think they use it

barren iron
#

Ok

little shuttle
#

Am I using pip and friends correctly? I have one package which depends on another, but I actually have a forked that dependency on my own github. So in the first package, I have requirements.txt with -e git+https://github.com/.../#egg=dependencyname. I got somebody to install the package with pip install -r requirements.txt, then pip install -e ., but the import dependencyname doesn't work (ModuleNotFoundError)

tawny temple
#

Does it work for you though?

#

It could just be an issue on their end with their commands

#

For example pip could be for Python 2 and they're using python3 as the command to run the program

#

That's a common scenario

little shuttle
#

Yeah, it works for me... I didn't think about Python versions, I'll check that

#

Maybe they have Python 3 default but pip2 or something, because I'm using f-strings which won't work on Python 2

lost rock
#

usually it's recommended to not call pip as system command but instead python3 -m pip or whatever the interpreter command you use for your application is

little shuttle
#

Oh really? I've never heard that before

#

I suppose that is a good way to ensure you're getting the right version

vivid cargo
#

If you are on linux, install python3-pip

pure pulsar
#

Not python3-pip ?

sinful zinc
#

it is python3-pip on ubuntu

#

idk about others

vivid cargo
#

My bad

bold coyote
#

you guys any tool to move programs from one disk to another?

vivid cargo
#

file explorer?

#

which os even

bold coyote
#

windows

vivid cargo
#

Default file explorer

dusty nexus
#

Hi, I'm looking for some package to test my programs efficiency. On the web, I've found tons of such packages, but I don't know which one should I choose. Measurement of the time of execution is simple, but what about examining RAM or CPU load?

limpid dirge
#

Heya, is someone familiar using IPython in jupyter?

finite fulcrum
#

Any idea why pycharm's run console isn't outputting PyQt stuff? Makes the debugger pretty useless when I don't see warnings

sand thistle
#

I am just starting to mess around with the pycharm debugger

#

I still don't quite understand it

#

Anyone know anything with regards to git? If I work on one file and make a new branch and change that file, shouldn't I be able to switch between branches and then have different versions of that same file?

#

or do I need to rename the file

brittle isle
#

@sand thistle no need to rename, that's the point of branches

#

Just git checkout to the branch you want to work on and git will automatically adapt the files accordingly

sand thistle
#

k

#

I was worried for a second

brittle isle
#

everything commited is “saved”, just remember that

sand thistle
#

but

#

hmm

#

for example I have a file called PyPDF.py

#

it's in two branches, however in my most recent one I wrote different code

#

when I git checkout to the branch I want to work on, nothing changes in my PyPDF.py file

brittle isle
#

did you really commit it?

sand thistle
#

I believe so

#

when I do git log

#

it shows different stages

#

hashes and labels

#

I also have 2 heads

brittle isle
#

yeah but that does not tells whether the file has been commited or not

sand thistle
#

how would I check

brittle isle
#

please show the result of git status

sand thistle
brittle isle
#

@sand thistle here you go, you have not commited any of these files

sand thistle
#

I thought that meant the red text wasn't comitted

#

im like 100% positive I commited the originaly PyPDF.py

brittle isle
#

you did not

#

or maybe you git deleted it afterwards, I don't know

sand thistle
#

so then why do I have different hashes in the git log

brittle isle
#

why wouldn't you?

#

that's the point of these hashes, being (practically) unique

sand thistle
#

I was under the impression that after you commit

#

you are to label the changes in the log

brittle isle
#

yes, but you have to git add the files you want to commit

#

otherwise they are not considered part of the commit

sand thistle
#

yeah

#

I did

#

git add .

#

then git commit

#

then it asks you to name it

brittle isle
#

do git status after git add to check the files that are staged to commit

sand thistle
#

? ok but that doesn't help me

#

like why is the log still there if the commit doesn't exist

#

I don't understand

brittle isle
#

the commit exists

sand thistle
#

but you're saying it doesn't contain my file

brittle isle
#

yes, it contains other stuff

#

like Pipfile or .idea/workspace.xml

sand thistle
#

this makes no sense.

#

if it has my pipfile..

#

then why wouldn't it have my .py file..

#

can I revert to a commit then?

#

since it seems to be hashed, then I should be able to switch to that version which would have my file?

rare sinew
#

I am create a QT application which is rapidly growing, I am getting to a stage where I kind of need to break it up a bit but am unsure how. Do anyone know of any articles that talks about this? Or maybe a good structured open source QT application that I can take inspiration from?

dire quartz
#

How come when I run a code inspection in Pycharm which results in both warnings and errors, they are all grouped under "Warnings", even though I've enabled grouping by severity? I would've expected there to be one category for each severity level.

#

Now I have to sift through hundreds of warnings to find the 5 errors.

tawny temple
#

Can a request made in Postman be exported to e.g. HAR?

#

Maybe that's not what I'm looking for even

#

Just want an easy way to share with someone how I did the request (all the headers and content, etc)

pure pulsar
#

you can show the postman console and extend everything in the log of that request i guess

tawny temple
#

Ah yeah that would work. Didn't know it had a console even

pure pulsar
#

not sure why they don't show it more, it's quite useful

#

sometime you have no idea what the error postman spits is about, and the console says it all

lost rock
#

who needs postman if they can use curl...

rapid tiger
#

Is there any tool bot to help one deleting his messages on discord after an amount of time? Assuming that he has no permission to add the bot to the server.

lost rock
#

No, automating any actions using a user account (not bot account) is not allowed by Discord's ToS and might get you banned.

rapid tiger
#

😂 Thank @lost rock

untold haven
#

Hey how do I use anaconda envs in atom

pure pulsar
#

@lost rock that's what i though, too, but saving/documenting calls in postman, is pretty convenient, for us it allows the products people to investigate api we want to integrate, as well as check the api we implemented, before releasing, we can save examples of the results of various calls, and it's shared between everybody. I can see the point.

random breach
#

anyone else get indexing again every single time you close/reopen pycharm?

#

it also happens every single git branch switch

#

the ide becomes unusable and almost maxes cpu every time

#

until indexing is done

finite fulcrum
#

yep, and skeletons

heavy berry
#

I'm trying to get python packaging tools installed in pycharm I'm not sure what I've done to it 😦

#

but when I click install python packaging tools in interpreter settings I get failed:

Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.3\helpers\packaging_tool.py", line 155, in main
do_untar(name)
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.3\helpers\packaging_tool.py", line 92, in do_untar
import tempfile
File "C:\Users\mobil\AppData\Local\Programs\Python\Python37-32\lib\tempfile.py", line 45, in <module>
from random import Random as _Random
ModuleNotFoundError: No module named 'random'

#

could this be a symptom of me not being able to use import random so I found the random.py file it referred to and copied it to my directory to allow me to use import random?

#

I'm tempted to just uninstall python copy data project files, uninstall python and reinstall both

#

ok, well I guess I was using the wrong interpreter as Im able to install random now

#

and pygame

dire quartz
#

Is it possible to configure the scope of a coverage analysis in Pycharm Pro 2019?

tawdry needle
#

@heavy berry something is really wrong if you can't import a stdlib module. you shouldnt ever have to "install" it

tawny temple
#

@dire quartz Not that I know of. I configure it with .coveragerc, which PyCharm will read

dire quartz
#

@tawny temple Oh, right. Well, that also solves my problem, thanks.

topaz goblet
#

Has anybody found a good Docker Image or Software that is fairly straightforward to wrap that can function as a Mail Server for Flask-Mail?

I've looked a few options but haven't ever used a mail server so I'm not sure what I need to be evaluating

tawny temple
#

I've configured a mail server myself (basically did most of what I linked but I did it manually)

#

And it was hell to figure out some stuff

#

There's lots of bits and pieces

topaz goblet
#

Yeah it seems like something fairly complex, and I'm just looking for email confirmation for user registration on a small freelance app

#

I will take a look, thank you!

tawny temple
#

Unfortunately it's been a while so I don't remember the details

#

Some stuff you'd probably want is a spam filter and DKIM or something

#

I don't remember it all

barren iron
#

How easy is it to make your own MX server

tawny temple
#

There's stuff you need to set up for your DNS

barren iron
#

?

#

I only want to forward emails, nothing else

topaz goblet
#

Yeah I've done some of the DNS work with GApps

#

Who's your registrar?

#

Namecheap has email forwarding built in if you use their DNS

barren iron
#

I currently use them

#

But if I cant. I have no idea what id do

tawny temple
#

I dunno what can be left out for forwarding. I worked on a full blown thing

#

I've really only done it once and it was for fun not for production use so I'm not a great person to explain this stuff

topaz goblet
vivid cargo
#

can i fiddle with venv within the code?

#

like making and activating it within the script

#

without calling os.system()

lost rock
#

I think you can e.g. import venv and call stuff there directly, yes. Check the docs for the module.

vivid cargo
#

i've been swimming through the docs and i can't find anything

#

i can't find anything mate

lost rock
#

never used it either, but that's the classes and functions it offers

#

guess you'll want to use venv.create(...)

vivid cargo
#

BOI

#

Lets get it

vivid cargo
#

@lost rock do you have some actual code examples/tutorials about this?

#

i'm kinda confused

lost rock
#

nope, never used it. Your googling is as good as mine there.

tawny temple
#

to activate a venv you can exec the venv/bin/activate_this.py script in

#

The docstring at the top shows you how to do that

vivid cargo
#

yeah, but within actual code

tawny temple
#

wdym?

#

You can activate it within code

#

that's exactly what the docstring shows how to do

vivid cargo
#
def create_venv(dir: str):
    virtualenv = venv.EnvBuilder(with_pip=True)
    virtualenv.create(f"./{dir}")
    return

how do i now activate the venv

tawny temple
#

I explained that above

finite fulcrum
#

any way to get pycharm to bark at me for undefined attributes in classes? For example self.letter in here

class Test:
    def __init__(self):
        self.number = 5

    def print_stuff(self):
        print(self.number)
        print(self.letter)
pure pulsar
#

pylint does that, maybe you can make pycharm use it

pure pulsar
#

anybody using rope with vim? it seems installing it and the ropevim plugin has no effect at all for me

#

i can import rope in python, but i get none of the rope commands in vim

finite fulcrum
#

@pure pulsar thanks! Won't be pushing silly mistakes anymore 😄

#

even complains about my 21 methods, it's great 😛

heavy knot
#

So uhh

#

whats the difference between github wiki vs github pages

#

when should I use one over the other?

tawny temple
#

Wiki is just simple markdown formatting and can be thought of as part of your repository

#

cause it's just a "tab" on your repo

#

github pages is a full fledged website

heavy knot
#

ok, so what should I use for documentation

#

gh pages says you can source from the /docs folder

#

but wiki says you can put docs there

#

so im really confused

tawny temple
#

GH Pages would be better if you're like using sphinx or something

#

and then you can host a frontend for those docs with gh pages

#

You can go either way

#

depends how fancy you wanna be

heavy knot
#

hmm

#

so I know gh pages cant support backend

tawny temple
#

Indeed plenty projects just use the wiki

heavy knot
#

how can I make it?

tawny temple
#

support backend?

#

wdym

heavy knot
#

yeah, like I use gh pages as a frontend hosting

#

and then I use like idk

#

heroku or smth for backend

#

and have them work together

#

I need it 100% free btw

tawny temple
#

Oh right

#

I am pretty sure GH pages is for static sites

heavy knot
#

But essentially I am using gh pages as a domain name and frontend hosting, and some other service for backend hosting

#

yeah thats what im saying, how can I use a different service with github pages to host a dynamic site

tawny temple
#

Ok this isn't a serious suggestion but you can just have ajax requests to load the site from heroku or wherever

#

I've not use GH pages myself so I'm not the best person to ask

heavy knot
#

hmm

#

In the (very near, like DAYS near) future I will be publishing articles on:
• How to Use Heroku + Firebase to Make a Free api Server
is from 2017 and has never made the article

vivid cargo
#

i can't use activate_this.py on windows

tawny temple
#

Oh

#

That may be something virtualenv creates then

#

😐

vivid cargo
#

so os.system() is needed?

tawny temple
#

No

vivid cargo
#

i tried to cat activate, activate.ps1 and activate.bat

tawny temple
#

I can send you the script it generates

#

and you can modify it

vivid cargo
#

all shell scripts

tawny temple
#

using the shell scripts is not the way to go

vivid cargo
#

i figured that out

tawny temple
vivid cargo
#

okay what do i need to change

#

i'm not that familiar with venvs on windows

tawny temple
#

Looks like line 17

#

Cause it expects this file to be in .venv/Scripts

vivid cargo
#

okay, what should i replace L17 with

#

actual string path?

tawny temple
#

instead of __file__ specify the path to the Scripts folder

#

I forget if __file__ also contains the file name

#

or if it is only the directory

vivid cargo
#
activate_this = '/path/to/env/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
#

do i have to point it to the venv?

tawny temple
#

No that's wrong but you made me realise L17 doesn't need to change cause you can specify it in the dict

#
this_file = '/path/to/env/bin/activate_this.py'
exec(open(this_file).read(), {'__file__': this_file})
vivid cargo
#

aaah

tawny temple
#

But this means you'll need to move activate_this.py into venv/Scripts first

vivid cargo
#

noice

#

hmm

tawny temple
#

The entire script operates on the assumption that the script is located in that directory

vivid cargo
#

yeah

tawny temple
#

Well

vivid cargo
#

that what's messing with me

tawny temple
#

I guess you don't have to physically move it

#

Maybe changing the value of __file__ is enough

#

So you'd need two variables: 1 for the actual location and one for the fake location for __file__

vivid cargo
#

umm

tawny temple
#

open() of course needs the actual location

vivid cargo
#

yeah

#

i'm so confused

#

i'm so tempted to use os.system

tawny temple
#

What is confusing you?

#

I am pretty sure os.system won't even work

vivid cargo
#

so, i'm going to run this project on different OS-es and different systems
and if i'm activating venv on linux, that's easy

#

but if i'm runnning my project on windows, that's gonna mess everything up

tawny temple
#

That didn't answer my question

vivid cargo
#

i'm confused about how would i go about activating it on windows

#

when i'm creating venv on windows, it won't create activate_this.py file

tawny temple
#

This file will be part of your project

vivid cargo
#

oooooooh

#

mind frickin blown

#

hm

#

and

#

it would point to the venv i create

tawny temple
#

when you exec() you just gotta give the right path and that should be it

vivid cargo
#

let me see

tawny temple
#

As I discussed you need to set the __file__ to be a path inside the venv

#

but the path for open() needs to be the actual path to the file

#

so ```py
actual_path = "/my/project/active_this.py"
fake_path = "/path/to/venv/Scripts/activate_this.py"

#

And this method is cross-platform

#

The only difference is that windows calls the bin dir Scripts

vivid cargo
#
exec(open(this_file).read(), {'__file__': this_file})

what here is fake and which actual

tawny temple
#

and you can easily change that by checking which OS it is

#

That line is really incorrect

#

exec(open(this_file).read(), {'__file__': this_file})

#

the value of __file__ in the dict is supposed to be the "fake" path

vivid cargo
#

i tried creating venv with bash and powershell

#

and neither did give activate_this.py

#

@tawny temple you here?

tawny temple
#

I already said you just include that file in your project

#

you dont need to rely on the venv to create it

vivid cargo
#

yeah but i'm reading that bash venv gives that file

tawny temple
#

I got it from pipenv

#

which uses virtualenv

#

I guess venv doesn't do it

vivid cargo
#

oh

#

um

#

nice

tawny temple
#

But it doesn't matter really

#

not a lot of extra work

vivid cargo
#

okay

frank leaf
#

@heavy knot you mean the file tabs or the menus at the top?

heavy knot
frank leaf
#

yhe, that's wrong. you have it opened as 1 project.

#

can I see your files at the left side?

heavy knot
frank leaf
#

you need 1 folder per project.

heavy knot
#

but thats sucky pepe

frank leaf
#

if you create a project with pycharm, it does that for you.

heavy knot
#

okay thanks

frank leaf
#

the thing is that it uses virtual environments, and each needs it own folder

#

do you know what that is?

heavy knot
#

yeah

#

i created a new project

#

and it didnt create a new configuration

heavy knot
#

In the flask documentation, they have a suggested project structure, using their example 'flaskr' blogging application.
In that example, they have a flaskr package, and a setup.py file. Now usually this is for something that you upload to pypi, but this is literally a blogging app, so I have no idea what it's for.
What is the purpose of a setup.py and package folder, for an application, not a package/library that you upload for others to use?

#

And how do I use it in my own application?

vivid cargo
#

i think it has setup.py because tutorial app is on pypi

#

in other cases, you don't need it

#

requirements.txt is fine

vivid cargo
#

hey @tawny temple

#

i'm fiddling with file from yesteday

#

when i'm doing

exec(open(this_file).read(), {'__file__': this_file})

where should i point this file to

vivid cargo
#

inside venv/Scripts on windows, and inside venv/bin on linux?

tawny temple
#

Yes, that's for __file__

vivid cargo
#

and this_file is a string path to the file i'm reading

tawny temple
#

Yes

#

To be clear __file__ should be a different value than what's passed to open()

vivid cargo
#

aaaaaaah

#

2 different path strings

tawny temple
#

Yes

vivid cargo
#

let me try it

vivid cargo
#

it didn't activate venv

#

@tawny temple

tawny temple
#

how'd you test?

#

did you try importing something after

vivid cargo
#
saki@Greg:/mnt/c/Users/KORISNIK/Documents$ python3 -m create-flask-app saki
yes db

Creating a new Flask app in ~/saki.

saki@Greg:/mnt/c/Users/KORISNIK/Documents$ cd saki/venv/bin/
saki@Greg:/mnt/c/Users/KORISNIK/Documents/saki/venv/bin$ ll
total 8948
drwxrwxrwx 1 saki saki     512 Aug 12 18:56 ./
drwxrwxrwx 1 saki saki     512 Aug 12 18:56 ../
-rwxrwxrwx 1 saki saki    2217 Aug 12 18:56 activate*
-rwxrwxrwx 1 saki saki    1273 Aug 12 18:56 activate.csh*
-rwxrwxrwx 1 saki saki    2437 Aug 12 18:56 activate.fish*
-rwxrwxrwx 1 saki saki     271 Aug 12 18:56 easy_install*
-rwxrwxrwx 1 saki saki     271 Aug 12 18:56 easy_install-3.6*
-rwxrwxrwx 1 saki saki     243 Aug 12 18:56 pip*
-rwxrwxrwx 1 saki saki     243 Aug 12 18:56 pip3*
-rwxrwxrwx 1 saki saki     243 Aug 12 18:56 pip3.6*
-rwxrwxrwx 1 saki saki 4571576 Aug 12 18:56 python*
-rwxrwxrwx 1 saki saki 4571576 Aug 12 18:56 python3*
saki@Greg:/mnt/c/Users/KORISNIK/Documents/saki/venv/bin$ source activate
(venv) saki@Greg:/mnt/c/Users/KORISNIK/Documents/saki/venv/bin$ deactivate
saki@Greg:/mnt/c/Users/KORISNIK/Documents/saki/venv/bin$
tawny temple
#

I think I misunderstood what you were trying to do

vivid cargo
#

after i create venv and *activate* it, deactivate command doesn't work

tawny temple
#

Thought you wanted to activate it inside python

vivid cargo
#

nope

#

i want to activate it inside current shell session

tawny temple
#

I don't know to accomplish that

vivid cargo
#

okay

#

thanks for help tho

#

really appreciate it

tawny temple
#

Np

vivid cargo
#

os.system() time

#

also, when i run os.system() does it open subshell within this shell?

#

so, if i'm running on cmd, it will open another subshell of cmd

#

and same with bash

tawny temple
#

Yes I believe it does

vivid cargo
#

okay

tawny temple
#

That's why I said I don't think it will work

vivid cargo
#

hmm

tawny temple
#

You'll probably need to replicate what the shell scripts are doing but in Python code

#

and you'll need to make sure changes persist to the environment (e.g. updating environment variables normally doesn't)

vivid cargo
#

env vars only stay in subshell?

tawny temple
#

Well not a subshell but it only applies to the the Python process

#

(and optionally any subprocesses it creates)

vivid cargo
#

aaah

#

so it stays there only for duration of python process

heavy knot
#

In the flask documentation, they have a suggested project structure, using their example 'flaskr' blogging application.
In that example, they have a flaskr package, and a setup.py file. Now usually this is for something that you upload to pypi, but this is literally a blogging app, so I have no idea what it's for.
What is the purpose of a setup.py and package folder, for an application, not a package/library that you upload for others to use? And how do I use it in my own application?

#

I want an indepth answer, and I want whoever responds to know what they are talking about

vivid cargo
#

in this case, setup.py is there only for flaskr to be available on pypi

#

that's pretty much it

tawny temple
#

I don't think that's the reason considering that PyPI package is not maintained by pallets

#

I'd say there is no good reason for them to have a setup.py and a requirements.txt would have sufficed

heavy knot
#

How about in general?

#

the question I have in bold?

violet belfry
#

If you're not going to pip install it then it has no purpose

tawny temple
#

I indirectly answered that question

#

Because you were asking about applications rather than libraries and flaskr is an application too

heavy knot
#

yeah, so if a requirements.txt would not suffice, what would I do

#

What is the purpose of a setup.py and package folder, for an application?

violet belfry
#

What does "would not suffice" mean?

#

The purpose of setup.py is for pip install

heavy knot
#

Mark:

I'd say there is no good reason for them to have a setup.py and a requirements.txt would have sufficed

#

like, what is different from a setup.py then a requirements.txt file

violet belfry
#

It's a script for pip install

tawny temple
#

requirements.txt contains the dependencies for your app

#

Using a setup.py is if you want to install your own app itself rather than just its dependencies

#

And, again, I don't see a point in doing that for a flask app.

#

Installing a package is useful if it's a library cause it makes it easily available for importing from other projects. It's also useful for command-line tools so that they can be used from anywhere

heavy knot
#

ok, so I remember one time I was making this discord bot

#

and it had a whole lotta files and imports everywhere

#

I was asking about this one import question

#

and someone told me I should create a package instead

#

how do packages affect imports from within the package itself?

frozen coral
#

pycharm or visual studio?

eternal flicker
#

If by visual studio you mean visual studio code, then it depends. I recommend trying out both and choosing what you like most

heavy knot
tawny temple
#

Yes that code definitely matters but it has nothing to do with setup.py

heavy knot
#

What is the purpose of a setup.py and package folder, for an application in general?

tawny temple
#

A package folder is for namespacing

#

A setup.py is for installing with a package manager such as pip

heavy knot
#

yes but, why would you need to do that

#

for something that you dont upload to pypa

tawny temple
#

Don't know

#

I already answered that requirements.txt would have been enough

#

Just because the author of the tutorial added it doesn't mean it's undoubtedly correct

#

Maybe they just thought installing dependencies with it would be easier than through requirements.txt but that's preference and such a minor thing

heavy knot
#

I am not talking specifically about the tutorial

#

so the only point of a setup.py is for install dependencies?

#

does it install the files inside the package too? or just whats listed as a dependency

tawny temple
#

It installs the project and its dependencies

heavy knot
#

ok, so wouldn't that be helpful for files inside of the package?

#

since you could import other files from the package from within the package itself?

tawny temple
#

You don't need to install the package to be able to do that, so not it wouldn't be helpful

#

If you wanted other packages in other applications/programs to be able to import your app then sure, it's useful to install (and I already mentioned that yesterday)

heavy knot
#

Well I am not talking about other packages or applications

#

I remember once I had some whack importing issue I got myself into when creating a discord bot, and they told me I should have just created a package to install instead

#

and I was curious what that person meant

tawny temple
#

To be clear, that suggestion is not related to setup.py

#

The suggestion meant to put all your modules (aka .py files) inside a folder (a package) and then to import other modules within your project you'd do from package import module for example

#

If you don't have a package then I think you're stuck with just relative imports like import .module

heavy knot
#

yeah, so how do I do that

#

do I not need to use a setup.py for that?

tawny temple
#

No, you donät

#

you literally just create a folder and move the files inside it

heavy knot
#

no thats what I did already

tawny temple
#

then run your program outside the folder

heavy knot
#

before I got into the jank importing issue

#

I had a folder "src" with 3 other folders, each containing 3 files, and each file was it's own subcommand, with each folder being it's own command, and the src holding all commands

#

but then I had an issue where I wanted from one file to import the file next to it, but it wasn't working

tawny temple
#

the imports would need to be like from src import module

#

from src.subfolder import module

#

etc

heavy knot
#

yeah and it was not working, there was some really weird issue (I cant recall what)

#

I ended up having to import it a SECOND time in the init file under a namespace

#

it was weird

tawny temple
#

I believe you need to run your program like python -m src.main (e.g. if main file is `./src/main.py)

#

And the current working directory must be outside src

heavy knot
#

we tried that

#

well I tried that before asking actualy

tawny temple
#

Alright, well if you want someone to try to help and take another shot at it feel free to ask in a help channel

#

But yeah this has nothing to do with setup.py

heavy knot
#

Why did he ask me to put it in a package? I am 100% sure he didn't mean a FoLdEr

violet belfry
#

I don't know why we'd know the answer to that

tawny temple
#

A folder is called a package

#

and subfolders are sub-packages

#

As it points out, confusingly, distribution packages are also called packages.

heavy knot
#

Wait a second

#

Yeah so how does this work?

tawny temple
#

Work in what sense?

heavy knot
#

it has 1 function

#

create_app

#

that returns the app

#

where is that called?

#

it seems really weird to do from __init__ import somthing

#

so how does that work

tawny temple
#

You don't import from __init__

heavy knot
#

yeah

#

I know

tawny temple
#

things in that file are considered to be part of the package

heavy knot
#

thats why I'm asking

tawny temple
#

it'd be from flaskr import something

heavy knot
#

so in that case, do you have to create a package to do that?

#

OH WAIT

tawny temple
#

no

heavy knot
#

THAT SOLVES THE ISSUE I WAS HAVING EARLIER

#

is it good practice to have code in init?

#

I read somewhere it isn't

tawny temple
#

Not neccessarily

heavy knot
#

and should only be used for importing

tawny temple
#

I only make it if I need to put something in there

#

Since python introduced namespace packages, a __init__.py is no longer mandatory

#

Anyway, the way create_app works is that Flask will detect it

#

In the tutorial, the package flaskr is specified as the FLASK_APP

#

Since anything defined in __init__ gets translated to being part of the package namespace

#

Flask will be able to find create_app function and use it

random breach
tawny temple
#

probably a bug with f strings

random breach
#

it was working fine just a while ago

#

i changed the method to use self.type instead of a local type variable

#

and then this happened

heavy knot
vital brook
#

So for jetbrains ides (pycharm) there is a great extension called keypromoterX that pops up keyboard shortcuts when you use the mouse for something that has a keyboard shortcut. Does anyone know if something like that exists for VS Code?

violet belfry
#

I don't think there are events in the API to support this

#

There are a few related issues but none have been implemented into othe API

random breach
#

can anyone confirm if they get the same issue? PyCharm 2019.2 here

tawny temple
#

Yeah same issue

#

Though it wouldn't happen if you passed cd for example

#

By the way, you can do path.open() 😉

random breach
#

dude you read my mind

#

i was just wondering if there's a path.open

#

i was thinking 'nah doesnt some pythonic since there's already one way to do it'

#

i get the same issue with cd as well btw

#

something's broken

#

(am specifying cd's type because Path.parent doesnt have a type annotation apparently. or pycharm's not picking it up correctly at least)

heavy berry
#

I assume it's a no given the reactions I got a while back but I am still looking for an option to code on my tablet, which is in another room from this desktop, unfortunately pycharm won't work on it and that interface is what is conducive for my coding experience I don't like the split up nature of the free ones online anyone in here use codeanywhere.com?

vital brook
#

I’m having that same pycharm path issue, 2019.2.

sweet scaffold
#

Guys which IDE is best for beginner python programmers?

vivid cargo
#

there are 2 IDEs for python really

#

pycharm and spyder

sweet scaffold
#

Only 2?

lost rock
#

there are for sure more than two. PyCharm is just probably the best known and generally most advanced. Probably not the ideal beginner's choice though for that reason.

sweet scaffold
#

@lost rock Thank you

rare mirage
#

Don't use an IDE

#

Keep it simple

#

Just use vim

lost dust
rare mirage
#

Or Sublime Text

#

But I rather recommend vim

#

At first you will look like a turtle

#

But after two months of constant work and programming

#

You will look like you are high on adderal

vapid bobcat
#

So why is vim better exactly?

rare mirage
#
  1. You get faster and faster, therefore, you get more efficient
#
  1. It's VERY lightweight
#
  1. You can customize literally EVERY part of it
#
  1. You look cooler B)
rare mirage
#

PD: I have recently used vim to design some web page, and man, I have never had to touch the mouse or something like that

#

So confortable

vivid cargo
#

I use atom

#

Best thing ever

rare mirage
#

Yeah yeah sure

#

IMPOSSSSSSIIIIIBRRUUUUUUU

#

NOTHING IS BETTER THAN VIM

vivid cargo
#

Lmfao

barren iron
#

I want to get better at programming with just a keyboard, but most of the programming I do is web based, so I'm switching tabs and interacting with sites a lot

vivid cargo
#

you can switch chrome tabs with ctrl+tab

eternal flicker
#

firefox too! reverse direction with ctrl+shift+tab

barren iron
#

@vivid cargo interacting with sites

vivid cargo
#

sites

#

ah

#

spams tab

heavy knot
#

honestly tho

#

thats what I do

#

just span the tab button

#

or use the arrow keys

#

I think every site should have a way to navigate using only the keyboard

barren iron
#

^ this

graceful patio
#

grrrr

#

ok

#

so i was using git with github on my laptop through git bash for windows

#

and it was all fine

#

it prompted me for github login details when i tried to push, and then it was fine

#

tried to use it on my desktop

#

it just doesn't ever ask for credentails

#

'The requested URL returned error: 403'

#

managed to get it working by generating a key using ssh-keygen

#

so it prompts for the secret when i try to push

#

come back about 20 mins later

#

same fucking thing

#

it doesnt ask for a passphrase, or to log in

#

or anything

#

it just gives up

#

ok os

#

so

#

in my github account

#

there is the key

#

in my .ssh folder, id_rsa.pub exists

#

but when i do git push, it just fucking gives up

#

doesn't ask for credentials, doesnt try to use the ssh key

#

again most of the tutorials/guides just go 'and now it works :D!!!'

vivid cargo
#

i am trying to activate existing venv

#

but from a script

#

and i cannot access current shell

#

os.system and subprocess always open new subshell (sh) and execute commands there

#

how can i access current shell and execute commands within current shell?

graceful patio
#

what

#

as in through python?

#

oh i see

#

i think the issue is potentially that 'current shell' doesn't really exist

#

in the sense that the python program is what is running in the shell

vivid cargo
#

yeah

graceful patio
#

so you can't have other stuff

vivid cargo
graceful patio
#

ah yep

graceful patio
#

So i got that working

#

need a bit of advice

#

I want to host some large (>20mb) demo files for my application on github, but i don't want people who clone to have to download these as well

#

is there anywhere i can put them on the repo, maybe on a wiki somehow, where they are hosted but aren't part of the repo?

heavy cipher
#

PIP always trows errors for me

#

sutch as

#

or

tawny temple
#

For pupy, make sure all the submodules were also cloned.

#

🔍

#

Couple of other things:

  1. Don't use sudo. Either do a user install (pip install --user m2crypto) or make a virtual environment
  2. Use Python 3 instead of 2. As you can see from the warnings, Python 2 will be EOL soon.
vivid cargo
#

try using pip3

graceful patio
#

Well this is odd

#

got my earlier issue sorted

#

I made a change to readme.md in browser on github, and it turns out i only commited to the 0.1.0 release

#

firstly, it seems odd that you can commit to a tag/release in the first place

#

secondly, did i just accidentally 'enter' the tree for that tag, or am i going to keep accidentally doing this

frozen coral
#

anyone here good at pycharm?

#

Is there a way I can add a breakpoint for every line containing a specific variable?

heavy knot
#

I'm learning git

eternal flicker
#

right place then

heavy knot
#

I'm going through the book on git's website and I'm trying to use cat .gitignore in this tutorial but it doesn't seem to be working right

eternal flicker
#

what OS are you on?

heavy knot
#

the way it's shown the line should continue past like

     <then I should be able to put stuff here>```
#

I'm on windows, using gitbash

#

windows 10 to be more precise

eternal flicker
#

and which part of the book are you at? I'm assuming you're reading the Pro Git book online

heavy knot
#

yeah Pro Git

#

I'm only on chapter 2

eternal flicker
#

right, I found the section

#

so cat doesn't do what you think it does

#

it's a program that stands for concatenate

#

what it does is it concatenates files and then prints the contents to standard output, which is usually your console/terminal

#

if you try cat file_with_words_in_it you'll see the contents of the file printed out

heavy knot
#

I know what concatenation is

#

okay let me try it

#

it just says "cat: file_with_words_in_it: no such file or directory

eternal flicker
#

ah, I didn't mean for file_with_words_in_it to be taken literally, rather a text file that has words written in it

heavy knot
#

oh okay let me try it with a fiel that has words written in it 😅

#

okay i see

#

it printed out the contents of the file

eternal flicker
#

so the section in the book says this:

Here is an example .gitignore file:

$ cat .gitignore
*.[oa]
*~
heavy knot
#

that's where I'm at

eternal flicker
#

what it is showing is the output of cat .gitignore being run in the shell, which then outputs:

*.[oa]
*~
#

it's showing that the .gitignore file contains the lines

*.[oa]
*~
#

it then goes on to explain what the first and second line mean

heavy knot
#

That's odd it doesn't explain cat

eternal flicker
#

it's a Unix command, the reason you have it on Windows is because of git bash

heavy knot
#

Is the book assuming previous knowledge then?

eternal flicker
#

I don't think so

heavy knot
#

ah

#

thanks for the explanation

eternal flicker
#

if you have any questions about Unix-like commands though, we have a #unix channel

#

I'm not sure if it works in git bash, but try man cat?

#

does that bring up the manual for cat?

heavy knot
#

nope

eternal flicker
#

ah alright

heavy knot
#

thanks for the help

sand thistle
#

question regarding git

#

hello
if I make changes to my .py file, and it was already commited to git
when I do a git status, should it now show up?

lost rock
#

if you saved the file and it is not ignored, yes

sand thistle
#

it's not showing up in my git status 😦

#

I'm getting a ``` modified: .gitignore
modified: .idea/workspace.xml
renamed: PyPDF.py -> Convert_to_text.py
new file: Pipfile

#

I did rename the file but that was a while ago

#

maybe I didn't commit the change or something?

tawny temple
#

If the change has already been committed then it wont be shown there

#

git status only shows uncommitted changes

sand thistle
#

I've made changes

#

it's just showing that I renamed the file

#

that was a while ago

#

since then I've made changes to the code

tawny temple
#

run git diff file_name

#

does that show the changes you've made?

sand thistle
#

file_name meaning the new file?

tawny temple
#

file_name being whatever file you're talking about

sand thistle
#

ok I did

#

aaaaaand nothing

tawny temple
#

Is it a new file?

#

I don't think it shows a diff for new files 🤔

sand thistle
#

well basically

#

no

#

it's not a new file

#

technically I started with one file, mistakenly delted the branch that it was saved to

#

recomitted

#

then changed file name

#

so my output is ``` modified: .gitignore
modified: .idea/workspace.xml
renamed: PyPDF.py -> Convert_to_text.py
new file: Pipfile

#

is it a new file? I don't know how to answer that

tawny temple
#

are you talking about this? renamed: PyPDF.py -> Convert_to_text.py

sand thistle
#

yes

tawny temple
#

what are you expecting to see?

sand thistle
#

well I made changes to the file

#

so I expect to see Convert_to_text.py

#

since I believe it should be in the staging area, because I made changes to it and want to commit

tawny temple
#

Yeah it should show up as unstaged

sand thistle
#

I mean I believe it's being tracked though, just don't know if the current iteration is being tracked

tawny temple
#

That doesn't make sense: a file is either tracked or it isn't

#

if you see the rename then the file is clearly being tracked

violet belfry
#

Renames and file changes will show up as a rename, not separately

sand thistle
#

could it be that I didn't commit the rename?

tawny temple
#

ELA is right but that is only once you've staged the changes

violet belfry
#

git status should be telling you which changes are staged and which aren't

sand thistle
#

my output to git status is ``` modified: .gitignore
modified: .idea/workspace.xml
renamed: PyPDF.py -> Convert_to_text.py
new file: Pipfile

violet belfry
#

That's it?

sand thistle
#

yes

tawny temple
#

You may have already staged the change

violet belfry
#

This is what it should look like

$ git status
On branch add-testing
Your branch is up to date with 'origin/add-testing'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        renamed:    testing/object_attributes.py -> testing/asdf.py

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   testing/test_classifier.py
#

where are you running this?

sand thistle
#

oh ok one sec

#
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   .gitignore
        modified:   .idea/workspace.xml
        renamed:    PyPDF.py -> Convert_to_text.py
        new file:   Pipfile

#

that's my full git status

#

im running this in the terminal on my IDE

#

PyCharm

tawny temple
#

run git diff HEAD:PyPDF.py Convert_to_text.py

sand thistle
#
index f5b01ac..e3d4220 100644
--- a/PyPDF.py
+++ b/Convert_to_text.py
@@ -2,20 +2,30 @@
 from PIL import Image
 import pytesseract
 import sys
-from pdf2image import convert_from_path
-import os
tawny temple
#

so are your changes there?

#

If yes, it means you have already staged the changes

#

and nothing is wrong

sand thistle
#

I mean I made changes in the code

tawny temple
#

I am asking if the diff is showing your changes

#

I can already see 2 imports have been removed

sand thistle
#

gah I have to pick up my mom >.<

shut vapor
#

any good opinionated formatter for pycharm?

sand thistle
#

@tawny temple yeah but im actually still using pdf2image import convert_from_path

#

as well as import os

tawny temple
#

So are you saying the diff you see is not correct/up to date?

sand thistle
#

what I'm saying is that the output says ```-from pdf2image import convert_from_path
-import os

#

which is not accurate

#

because I am actively using both of those modules in my code

tawny temple
#

Something is not adding up then

sand thistle
#

yeah

#

maybe I can just undo everything?

#

and save what;s current

#

*commit

#

this is my current import section

#
import pytesseract
import sys
from pdf2image import convert_from_path, convert_from_bytes
import os.path
import re
from collections import Counter```
tawny temple
#

Is there more to the diff?

sand thistle
#
diff --git a/PyPDF.py b/Convert_to_text.py
index f5b01ac..e3d4220 100644
--- a/PyPDF.py
+++ b/Convert_to_text.py
@@ -2,20 +2,30 @@
 from PIL import Image
 import pytesseract
 import sys
-from pdf2image import convert_from_path
-import os
tawny temple
#

that's it?

sand thistle
#

that's the whole thing

tawny temple
#

I don't know what's wrong

sand thistle
#

I may have more than one headd?

tawny temple
#

head will just be the latest commit

#

its comparing the file from the latest commit to the staged file you currently have

sand thistle
#

welp

#

Idk

tawny temple
#

You can try to commit it

sand thistle
#

I want to share this on github as well as back this up locally

tawny temple
#

You can commit then create a new branch from it

#

then push the branch and check online if the file is correct

#

I am suggesting a separate branch so you don't mess up the one you have online (well you can always force push but it's better to avoid that)

sand thistle
#

ok

#

so I tried to commit

#
Found a swap file by the name "~/PycharmProjects/OCR/.git/.COMMIT_EDITMSG.swp"
          owned by: blah   dated: Sat Jul 20 17:32:16 2019
         file name: ~blah/PycharmProjects/OCR/.git/COMMIT_EDITMSG
          modified: YES
         user name: blah   host name: blahs-MBP.home
        process ID: 24227
While opening file "/Users/blah/PycharmProjects/OCR/.git/COMMIT_EDITMSG"
             dated: Sun Aug 18 20:27:11 2019
      NEWER than swap file!
-- More --
#

as you can tell

#

I am new to this

tawny temple
#

uh

#

I think this is because you are in the middle of a commit

sand thistle
#

oh

tawny temple
#

like it's waiting for you to enter a commit message

#

I think that's why this happens

sand thistle
#

well

#

how would I access that section then

tawny temple
#

can you just delete that file its referring to?

#

then try to commit again

sand thistle
#

I kinda just kept hitting enter

#

cuz I was scrolling throught he messages

#

it basically said this is happening because a) someone is editing this already b)needs a name

#

and then I kept hitting enter and it's asking me for a name

#

so I'm going to write one

#

but before I do I'm going to save my code to a paste bin

#

incase for somereason I screwed mysel;f

#

I wonder which version will be committed

#

the most recent or changes or the one that I started

eternal flicker
#

what are you checking the difference between?

sand thistle
#

uh oh

#

between git commits

#

do I override idk

#

I don't understand what's happening my goodness

tawny temple
#

I would suggest you just back up all your changes and try to scrap whatever commit you had currently

#

I mean the commit you had in progress

sand thistle
#

you mean the one tht's read only

#

I saved my code to a paste bin and emailed it to myself

tawny temple
#

do you have any commits you have not pushed?

sand thistle
#

how do I check that

tawny temple
#

git log

#

see if head is past origin

sand thistle
#

alright I had to exit the git commit message section

#
[No write since last change]
#

going to check log now

#

omfg stressful

#

im still in it

#

it's a loop for gods sake

#

head is pointed to master

#

I had another head in there because I tried to make a new branch

#

and to be clear I haven't pushed anything yet, I've only been working locally

tawny temple
#

so you see something like (HEAD -> master, origin/master) on one commit?

sand thistle
#

I see three hashes

#
  1. no ()
#
  1. (PyPDF)
#

3)(HEAD->master)

tawny temple
#

🤔

sand thistle
#

3 commits

tawny temple
#

where is origin then

#

have you set up a remote?

sand thistle
#

no I havent set up a remote

tawny temple
#

oh ok...

sand thistle
#

I've been working locally

tawny temple
#

I was thinking you could just clone from remote and apply your saved changes

#

So did you ever delete ~/PycharmProjects/OCR/.git/.COMMIT_EDITMSG.swp?

sand thistle
#

I don't think so

tawny temple
#

You should

#

then try to commit

sand thistle
#

how would I delete that

tawny temple
#

it's just a file in a folder

#

you can use git rm ~/PycharmProjects/OCR/.git/.COMMIT_EDITMSG.swp probably

#

or just rm if you're using git bash

sand thistle
#

hmm

#

well it asks for a file

#

rm doesn't work, even though I'm on unix

#

so when I put in the full file path

tawny temple
#

does the file still exist?

sand thistle
#

didn't match any file

tawny temple
#

I guess that resolved itself then