Add file from working directory into code - intellij-idea

Is there a 'shortcut' way to add a file in the code in pycharm? I have this structure everything is in a folder called 'myFolder' that you cannot see on the picture.
Using e.g. Visual Code I was able to reference the file like this:
df = pd.read_csv('in/test_DS.csv', sep=';', encoding='iso-8859-1')
is there a similar way in Pycharm or do I have to do full reference?

There is currently no such feature, but there is a corresponding feature request https://youtrack.jetbrains.com/issue/PY-33254 which is In Progress and expected to be in 2019.2 version.

Related

I don't manage to add a file to my QML project with Qt Creator Qt6

I feel a bit ashamed but I simply don't manage to add a file to my QML project in Qt Creator.
I use Qt 6.2.3 and my build system is qmake.
First off, I created a file MyButton.qml by doing a right click on the folder named QML of a project which only contains a main.qml file.
Then, when I type MyButton in main.qml I can use the autocompletion so I see Qt Creator detects my new type.
But during executation, I got this error :
QQmlApplicationEngine failed to load component
qrc:/MyProject/main.qml:9:5: MyButton is not a type
Anyone knows how to add a file to a project ?
I carefuly followed the official documentation (https://doc.qt.io/qt-6/qtqml-documents-definetypes.html) and several tutorials but nothing works. That's crazy.
EDIT :
I did what JarMan advises but I still get the same error.
Here is an image of my project arborescence
And the content of the qml.qrc file :
<RCC>
<qresource prefix="/">
<file>MyButton.qml</file>
<file>main.qml</file>
</qresource>
</RCC>
I believe the problem you're running into is simply that your executable doesn't know where to find your .qml file because the build folder is usually not the same as the source folder. To fix this, you should create a resource file (you can name it something like qml.qrc) and list all of your QML files in there. This allows the QML file to get bundled into the executable.
An example would look like this:
<RCC>
<qresource prefix="/">
<file>MyButton.qml</file>
</qresource>
</RCC>
Then in your .pro file, add this line:
RESOURCES += qml.qrc
EDIT:
You can do the same thing in Qt Creator.
Step 1:
You might already have a resource file in your project. If so, you'll see it in the Project view on the left side of the window. If you do, you can skip to Step 2. Otherwise, go to File->New File... and select Qt Resource File. Name it qml.qrc (or whatever you like).
Step 2:
Once you've created that file, it should now show up in the Project view on the left. You can right-click on the file name and select Add Existing Files. Choose your MyButton.qml file. That should do exactly what I mentioned in my original answer, but without manually typing any code.
I got the same error with Qt 6.3.1
I found the Qt Creator doesn't generate the qml.qrc file when you select Minimum required Qt version: to Qt 6.2.
So I switched the Minimum required Qt version: to Qt 5.15 in Qt Creator Wizard, the qml.qrc file will generated and my custom component qml file would be included automatically in it.
Also, the .pro configure file has different items between these two Qt version.
Solution 1:
add qml in the pro file:
resources.files = main.qml MyButton.qml
Solution 2:
add a qrc file into project and add qml as resource file

The location of .config for geotiler on Windows

I'm working in jupyter notebook on Windows with matplotlib basemaps and I want to use geotiler with the basemaps. I'm writing a program and as part of it, it will generate a map and plot data points on it. However, the maps that my code generates often are over a small part of the world and have no defining features. My solution was to import the geotiler library and display it over the map with an alpha so the maps generated would be identifiable. However, when I use the geotiler.Map() function, I get a message saying that the configuration file does not exist.
The code and the error message
How do I locate the .config folder on Windows, if it exists, and where should I create it if it doesn't? I already tried my user folder but that didn't seem to work. Thanks in advance.
Figured it out.
The read_config() method in the source code tries to get the HOME environment variable, which for Windows is blank, and appends the path for the config to that. Importing os and manually setting the HOME variable to wherever you placed your .config folder seems to do the trick. You can do this with os.environ['HOME'] = 'C:\Users\YourName'.

Add external libraries to my project issue

I try to add external library to my current project, but my project can't pick up the library.
I have MyLib.java file in other directory.
/Users/cat/myfile/github/JavaLib/MyLib.java
I want to my current project (/home/project/HelloWorld/HellowWorld.java) to use my MyLib.java
I'm following the steps to add Library to Intellij(15CE)
Menu->Project Structure->Libraries
click (+) symbol->select Java -> select my path(/home/lib/)
Here is the screenshot
Now that you have added your JavaLib directory to the project you should be able to use the code inside JavaLib in your code now. Intellij should offer auto-complete when you start to type the name of a JavaLib class and automatically include the import for you in your code.
The disabled Apply button you circled isn't an issue. I get that in my view too. It just means nothing has changed that needs to be applied currently.

IntelliJ "Can't find" Movie File

I am having serious trouble opening, actually finding, any kind of Video Files with IntelliJ.
The files are in a folder called "data" in my Project Directory. In the Project Structure Settings I made sure the Folder is recognized as Source. Then I even declared my *.mov & *.mp4 files as new Filetypes.
But still when I am trying to load the video like:
mov = new GSMovie(p, "camel.mov"); or even
mov = new GSMovie(p, "data/camel.mov");
It doesn't find it.
I also tried different libarays.
and keep getting:
File camel.mov does not exist. Please check location.
Actually I just found out that it is looking in the IDEA app binary itself.
The JMC-Video for Processing:
Media unavailable: file:/Applications/IntelliJ%20IDEA%2010%20CE.app/bin/data/look321.mp4
It works if I copy my files now there, but this can't be right.
It feels like I am doing something fundamentaly wrong, but I just can't see it.
thanx, for any help.
You should add *.mp4 and *.mov to Settings|Compiler|Resource Patterns
Set the working directory to the project root in the Run/Debug configuration.

After adding new class file to App_Code, build action is Content instead of Compile

In VS2008, I am adding new classes to a web project.
When I right-click on App-Code -> Add -> New Item -> Class ...
The build action for the newly created item is set to content instead of compile. This seems like it would be a problem with the template. I've found several others through google who have run into this issue, but nobody seemed to have found a more permanent solution, other than "change it from content to compile after creation."
My question: Does anyone know of a fix for this, official or otherwise?
App_Code is a special folder meant for folder based projects.
This is just a hunch, but it might be that you have a project file based project, instead of a simple folder based one.