Eclipse 4.5 (Mars) / Windows 7
I have an Eclipse C/C++ Makefile project that has both Python and C/C++ code. The source code is checked-out from an SVN repository. The build environment is via a MSYS shell using a project specific configuration script to create all Makefiles in the top/sub-directories and 'make', 'make install' to build.
My .project file has both the PyDev and CDT natures configured.
I can switch between the PyDev and C/C++ perspectives and browse code including right-clicking on a symbol and 'open declaration'.
The 'Debug' perspective appears to be specific to the C/C++ perspective.
Do you have experience with configuring an Eclipse project that allows you to debug both Python and C/C++ code?
After 'googling' around the internet, here is what appears to be working for my particular situation:
Create a C/C++ project (empty makefile project). This produces the following 3 files in my top-level local SVN check-out directory:
.settings
.cproject
.project
Note: I keep my Eclipse workspace separate from my Eclipse project.
Create a separate Python project that is outside of the local SVN check-out directory.
Note: This Eclipse Python project is in my Eclipse workspace.
This creates the following 2 files:
.pydevproject
.project
Copy the .pydevproject to the directory containing the .settings, .cproject, and .project files.
Copy the Python 'nature' elements from the Python .project file to the CDT .project file.
Restart Eclipse if it had been running while editing the dot (.) files.
Finally, get into the "C/C++ Perspective". In the 'Project Explorer" window, pull down the 'View Menu".
Select 'Customize View...'.
Select the 'Content' tab.
Uncheck the 'PyDev Navigator Content' option.
Related
I am working on a C# application. Inside this program it looks through a directory and uses files in the same directory containing the exe files in the debug folder. I added a setup project, for deployment, to the solution for the application. I tend to be naive and figured I could just drop the files and folders into the installation folder after I install it on another computer. I know there is a way to add these files and folders to the projects and set it up to have the installer install these files at the time of installation.
I assume you are working with Visual Studio 2010, and using Visual Studio Installer Setup Project to create an MSI output file.
Right click on the Setup project, select View menu, and select File System.
In there you are able to define files and folders to be installed.
I have created a PyDev project in eclipse. I have added PyDev packages to the project. How can I build and compile PyDev package from command line. I am using linux virtual enviornment. The project structure is shown below.
e.g. I want to build and compile "bridge" package from command line. (reference project structure in image). This package do not have dependencies. So that it could be build and compiled individually.
PyDev Project structure
You don't really compile files for Python, just run them and their bytecode will be generated on demand and then used to run the code.
See: http://www.pydev.org/manual_101_run.html for details on how to run your code inside PyDev.
I downloaded my old project from the repository and there are a lot of unresolved references now, how can I fix them?
If you are working with a virtualenv you have to configure your project to let Pycharm know what interpreter should be used and where are its dependencies.
https://www.jetbrains.com/help/pycharm/2016.1/adding-existing-virtual-environment.html
You should configure your Python interpreter and get Django installed. In the documentation you 'll see:
Selecting Python interpreter for a project
An interpreter can be made the project default when is it added.
To configure Python SDK for the current project follow these steps:
Open the Settings dialog box, and click Project Interpreter page.
In the Projects pane, choose the desired project.
For the selected project, choose SDK from the list of available Python interpreters and virtual environments. This list includes:
Python interpreters, which reside in standard locations.
Virtual environments, which reside under the project folder, or under the folder specified as an environment variable WORKON_HOME.
Other Python interpreters, installed locally or remotely.
If the desired interpreter is not in the list, click cogwheel button, and configure the desired interpreter as described in the
section Configuring Available Python Interpreters.
Apply changes.
Short, problem description:
When I try to run/debug a pylons project using paster via PyCharm it can't find the Thrift ttypes module that is being imported. If I run paster manually it works fine. The error message is just:
File "/myproj/lib/timetools/__init__.py", line 13, in <module>
import lib.thrift.common.international.ttypes as international_ttypes
port Error: No module named internation.ttypes
Long description:
I am trying out PyCharm for the first time. I have downloaded and installed it on Mac OSX Yosemite and pointed it at the project directory and I have configured the virtual environment (python interpreter).
Project structure (the part relevant to this question) looks like:
/myproj/lib/timetools/__init__.py
/myproj/lib/thrift/common/international.thrift
/myproj/build/py/lib/python2.6/site-packages/lib/thrift/common/international/ttypes.pyc
/myproj/mypylons/config/development.ini
My virtual environment is set to /myproj/build/py/bin/python.
If I go to my project root directory and run my activate script to use my virtual environment, I can successfully run:
paster serve config:/myproj/mypylons/config/development.ini
And the server starts up and responds on the appropriate port.
The way I configured PyCharm to run the pylons it tries to execute the following:
/myproj/build/py/bin/python "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py" --multiproc --client 127.0.0.1 --port 53432 --file /myproj/build/py/bin/paster serve config:/myproj/mypylons/config/development.ini
And I get the error above. It would seem that PyCharm can't find the international/ttypes.pyc file in my build directory even though it is included in the project. I tried setting the working directory to /myproj/build/py/lib/python2.6/site-packages but that didn't help.
As a note, when I look at the Project Interpreter configuration I do see the Thrift package there with a path of /myproj/build/py/lib/python2.6/site-packages.
Help!
From my experience it seems like you have to tell PyCharm exactly where the files are through the Project settings:
Go to Settings and then to Project Structure
Find the folder to which the ttypes are compiled to and click on it
On the Mark as: line, above the directory tree window, click on Sources (should be colored blue)
Click on 'OK' and you should be good to go
Hope it helps!
I am running Eclipse Luna on a windows 64bits system, and installed pydev plugin, using python 2.7.8 as interpreter.
I imported a project from GitHub. Once this done, did right-click on the project, then:
pydev/Set as pydevproject
then once more right-click on the project, then:
pydev/Set as source folder (add to PYTHONPATH)
When I did this on other installation, in the package explorer the python package icons used to change from a "directory" icon to a "package" icon. But this time it did not happen.
The status is
I can run the python files from eclipse ok
but if I go on a package, perform right click then select "new", I do not have "module" in the list of possible options, but I am presented with the usual java related list (Java project, project, class ...)
Anything I could do ?
I think that the problem is that you're using the Java Package Explorer, not the PyDev Package Explorer... If you go to the PyDev perspective (window > open perspective), you can activate the PyDev perspective which'll already show it to you... or you can go to window > show view > pydev > pydev package explorer.