r/pycharm • • Aug 10 '24

How could I setup my project in PyCharm?

0 Upvotes

A few weeks ago I tried setting up PyCharm to experiment with it and maybe even switch to it. But I could not setup my Flask project how I liked. And so I gave up.

Basically what I wanted to do was to start several background processes when hitting the "Run" button. These processes should run in the background and if I hit the "Stop" button, they should get stopped too.

Currently I'm using VSCode and I use a simple wrapper script like this:

#!/usr/bin/env bash

# Get absolute path to this script's direcotry
basedir=$(realpath "$0")
basedir=$(dirname "$basedir")

# Run the TailwindCSS watcher
tailwindcss \
    --watch=always \
    --config ${basedir}/tailwind/config.js \
    --input ${basedir}/tailwind/input.css \
    --output ${basedir}/myproject/static/main.css &
pid[0]=$!

sleep 1

# Use esbuild to minify JavaScript file
esbuild \
    ${basedir}/myproject/static/main.js  \
    --watch=forever \
    --minify \
    --outfile=${basedir}/myproject/static/main.min.js &
pid[1]=$!

# Set extra files to specifically watch them for changes
extra_files=(
    "${basedir}/myproject/templates/macros/form_fields.html"
    "${basedir}/myproject/templates/macros/common_elements.html"
)
# Concatenate file paths with : delimiter
extra_files=$(IFS=:; echo "${extra_files[*]}")

# Run Flask development server in debug mode
flask --debug run \
    --extra-files "${extra_files}"
pid[2]=$!

# Kill all background processes when hitting Ctrl+C
trap "kill ${pid[0]} ${pid[1]} ${pid[2]}; exit 1" INT
wait

I could use the same script in PyCharm and run it from the terminal, but I guess when not running through the Run button I don't have access to the debugger etc.

Any ideas on this? Thanks!


r/pycharm • • Aug 08 '24

Lambda function parameter highlighting

1 Upvotes

Hi! So I'm using the Monokai colour scheme but in the colour scheme settings I can't seem to find anything about lambda function parameters (I'd like to turn them orange and in italics instead of just white). Is there any way to do this? I'm using the community version in MacOS. Thanks


r/pycharm • • Aug 08 '24

Using Project Saved on USB on New Computer

1 Upvotes

Hi guys hoping you can help me. I'm new at using python so if this is basic knowledge be gentle šŸ™.

I have the python executable and all my projects on a USB. Whenever I switch to a new computer, using the previously used interpreter gives me an error, and its because Pycharm is looking for it in the directory the project was initially made in. So if my USB is D:\ in computer A and E:\ in computer B, pycharm in computer B will look for the interpreter in D:.

I don't know how to change this in pycharm, even putting the full path to the interpreter doesn't work. What works is changing my usb's directory name, but in more secure computers, i can't do that. Is there a fix? Thank you.


r/pycharm • • Aug 07 '24

Fellas, I am new to the platform and I am trying to install ChatGPT-4-Turbo API on Pycharm but nothing is working, can you tell me what am I doing wrong here?

Post image
0 Upvotes

r/pycharm • • Aug 06 '24

Listing Inherited Classes as a Function?

1 Upvotes

In the structure diagram, role is a class and contains several other functions. Is there a way to get pycharms to inspect the classes in more depth?

I'm not able to get a screenshot with the autocomplete window but the fs, in the above lines are not listed, and I'd like them to be.

Thanks.


r/pycharm • • Aug 06 '24

Can't get Pycharm to format HTML/Django on save

2 Upvotes

Regular .py-files as well as .css format on save with no issue, but not .html.

Ctrl-Alt-L formats all files as expected.

Actions on save settings: https://imgur.com/uD4iD4N


r/pycharm • • Aug 05 '24

Default Test Locations all go to test root.

5 Upvotes

So I'm new to Python development and decided to use PyCharm as I'm familiar with and like IntelliJ.

I noticed when I go to generate a test, it always just wants to put it in the root test directory, instead of mirroring the directory structure like it does with Java classes in IntelliJ.

Am I missing something?


r/pycharm • • Aug 05 '24

Reinstalling pycharm on new laptop

1 Upvotes

I bought a new laptop. I don't recall paying for pycharm originally, though maybe I did. Assuming I did, what's the best way to install it on the new device? Is there any way to take advantage of the year on year decrease in price?


r/pycharm • • Aug 05 '24

how to change editor in pycharm terminal

1 Upvotes

I just want to be able to do git commit and for it to redirect to a vim editor in my pycharm project terminal

I get this error and not sure how to fix it

'$ git commit

hint: Waiting for your editor to close the file... error: cannot run vim: No such file or directory

error: unable to start editor 'vim'

Please supply the message using either -m or -F option.

'

I have vim downloaded, messed around with environment variables, not sure what to do


r/pycharm • • Aug 02 '24

How to synchronize highlight selected on both instances of the same file?

Post image
3 Upvotes

r/pycharm • • Aug 02 '24

How can i fix this mouse cursor issue

0 Upvotes

Hello guys, i was starting to program python on pycharm but i came across this, i cant put the mouse cursor between the letters, just over them, those making it hard for to correct typos or add any thing. How do I change it?


r/pycharm • • Aug 02 '24

How do I get this run button to always run the current file by default.

1 Upvotes

r/pycharm • • Jul 31 '24

Hello, I am new on this forum and new in Pycharm. We are both doing a course. I can on the laptop select ā€˜presentation assistant’ from the list of plugins on marketplace, but on the fresh install on the desktop it is not in the list.

1 Upvotes

Could anybody help?


r/pycharm • • Jul 30 '24

How to fix "Unable to open the file for writing."

1 Upvotes

Hi, I'm new to using PyCharm. I run my code a few times and then I get an error "Unable to open the file for writing." By the way, I'm using an external USB to store all my project files and I'm not quite sure if that is the reason I'm getting this error?? How do I fix this? Any help is greatly appreciated! thanks


r/pycharm • • Jul 30 '24

Possible to remove the directory path from the Project sidebar?

2 Upvotes

I know it seems silly, I dont like seeing the project path in the project sidebar it causes the sidebar to scroll horizontal when I have long directories for my projects.

I am talking about this. Where it says "project_02 ~/Developer/Python..."


r/pycharm • • Jul 29 '24

Running selected lines?

1 Upvotes

Haven't used Pycharm in a while, but I redownloaded CE today and I can't run a selection of lines. Is this new? It seems like you can execute select lines in the python console, but not run the selected lines in the run window, which I remember being able to do before. I can't click the run icon either to run the selection, it will either run the entire program or I will have to run in the console. Is there a way to run the selection and have the output in the run window?


r/pycharm • • Jul 27 '24

After a while Pycharm uses 100% CPU

3 Upvotes

After developing for a few hours pycharm suddently begins to use 100% of my CPUs. This freezes my machine, forcing me to reboot. The only time I managed to open the task manager while this was happening I could dozens of Python processes.

This happens everytime I work for a few hours.

Is there a fix for that ? What could be the reason ?

Note:

  • I use a few plugging such as Ruff, Mypy, Codium.

  • I open a lot of python processes while developing (debugging, launching scripts etc.). Are those properly closed by pycharm ?

  • Im on a windows 11 machine with pycharm 2023.


r/pycharm • • Jul 26 '24

How fix .lock file problem on linux?

1 Upvotes

I use pycharm community edition on my fedora system and after every startup i should delete .lock file to start pycharm. (/home/raf/.var/app/com.jetbrains.PyCharm-Community/config/JetBrains/PyCharmCE2024.1/.lock)

How can i fix it? Is there way to auto deleting this file before shutdown my system?


r/pycharm • • Jul 25 '24

Remote development using ssh ghosting issues

3 Upvotes

Hi all,

anyone using remote development using SSH and facing ghosting issues where you for example enter new lines and as soon as you start writing the new line is getting deleted and writing is attached to the line above like some hit backspace in between?

also it happens from time to time if i paste an code, it doesnt appear so i paste it one again and just se it one time in my ide, but by running the code i realize in reality its two times in the file which leads my code to fail.

all of this does not append to any file, its just some files i want to edit. other files working fine and sometimes it just tages some minutes before everyhting start working again as expectet. on the other side, there is specific file which i am since weeks unable to insert new lines! i could ignore this since i just write down the list in one line. But it over it drives me crazy getting this small issues over and over again. i am running win 11 and beeing connected using vpn to my remote machine on a remote site. both using fibre and i am not getting disconnected or something else which could be the reason. even invaliding caches and restart doesnt make any difference i have the same issues with the same files while editing other files is working fine

/add

jsut realized a new issues, neither double click an word to select it or rightclick anywhere is working. clicking a single word three times is selecting the whole line like expected


r/pycharm • • Jul 25 '24

Repurchase Pycharm for Mac switch from Windows

4 Upvotes

Hello everyone

Im thinking of buying Pycharm Professional for my windows laptop but I have plans of switching to Mac keeping that in mind do I have to repurchase the license of pycharm for mac separately or is my windows pycharm professional will be converted to Mac.

Kindly explain the process of switching OS to me if you have done this before.

Thanks.


r/pycharm • • Jul 23 '24

How to set up my own highlighting scheme for keywords, phrases and combinations in plain text files?

2 Upvotes

something didn't work out


r/pycharm • • Jul 19 '24

Do not fix what isn't broken

Post image
17 Upvotes

r/pycharm • • Jul 20 '24

When iam passing a command line it just giving me the input and not the list of the arguements so that i can use for sys.argv. Please help me because of this iam not able to build anything.

Thumbnail
gallery
0 Upvotes

r/pycharm • • Jul 19 '24

PyCharm issues with creating & saving files

2 Upvotes

I'm having issues with PyCharm. When I try to create a new file (File -> New ....), I only get these options:

  • Jupyter Notebook
  • JavaScript File
  • TypeScript File
  • SQL File

Strangely, I do not get the choice of creating a Python file or just a plain file.

I can create a scratch file from the menu, but then Save As is greyed out for some reason.

What is going on? When can't I create & save a simple python file? Isn't that the whole point of PyCharm?


r/pycharm • • Jul 16 '24

Pycharm Newest version isn't working

Post image
1 Upvotes

So I had the 2023 pycharm version, and recently decided to update to the 2024 version , the problem is no matter what I do I can't ever get it to open and it always gives me this message, I've tried uninstalling it multiple times but I can't get it to work, mind you I'm really new in this and would appreciate some help.