I have current version of Pycharm Community Edition 2017.2.4 installed on Linux and on Windows.
In the one working on Windows, I open non-project files and while I write code in them, there is autocompletion for in-project modules, classes, etc.
On the Linux (Debian) however, when I write code in non-project file , there is autocompletion only for non-project modules.
Some additional info:
Those in-project modules are installed via PIP on both systems in the same way:
pip install -e .
I can run non-project files importing those project modules in both cases.
On Linux I use virtual-env but have set correct project interpreter (as suggested in similar question: Why isn't PyCharm's autocomplete working for libraries I install?)
It looks like autocompletion uses system interpreter for those non-project files only. I have loaded several projects and in one of them there is autocompletion for the other.
Ok, I found out the problem was not with OS.
To turn on autocompletion for non-project files it is needed to add libraries you use to External libraries. Instruction how to do this is in https://stackoverflow.com/a/24206781/4601890
Related
I try to write a simple plugin with gimpfu in python and I tried following those instructions.
1.2. Installation
Gimp-python consists of a Python module written in C and some native python support modules. You can build pygimp with the commands:
./configure
make
make install
This will build and install gimpmodule and its supporting modules, and install the sample plugins in gimp's plugin directory.
Where do I have to execute those commands?
I tried adding my script to the plugins folder but it seems like there is no python module called gimpfu. I believe I have to enable or install it in some way, but I can't find a solutio to do it.
EDIT: It seems like gimpfu is availible in the gimpfy-console insode gimp. It just doesn't seem to be availible for my plugin scripts.
No need to install anything. In the Windows versions Python support is built-in, and the gimpfu import is available when your code is executed by Gimp.
If you don't see the plugin in the menu it is likely a syntax error that doesn't let it run its registration code. See here for some debugging techniques.
However, since you mention PyCharm, you may have another Python interpreter installed and this makes things complicated because there can be conflicts depending on order of installation (and remember, Gimp uses Python 2.7)
Now it all depends if you are really doing a plugin (called from the Gimp menu) or a batch (where Gimp is called from a shell script), which is somewhat different. If you are writing a batch, see this answer for an example.
you don't need to install anything, on windows gimp comes with a python interpreter along with the libraries inside of it.
if you want to run your script from inside GIMP then you should check this answer and you should add the path to gimp to your system PATH environment variable (which is C:\Program Files\GIMP 2\bin on my system) , and instead of calling gimp-console.exe you should replace that with whatever gimp-console is currently available in that folder, the one on my system is gimp-console-2.10.exe.
I'm currently moving a project between home and work using svn. The IDE I'm using is PyCharm which I find awsome. I get everything integrated into one tool.
PyCharm has the ability to create a setup.py from the virtualenv for me that I also commit to svn.
By default PyCharm is adding files to my svn repo with full recursion.
Should I also let PyCharm add the Include and Lib folders of my project and the Scripts folder? I run version 2.6 at work and 2.7 at home but I don't really want that to matter either since code wise it doesn't.
To me it seems better if that is updated on the other machine running python setup.py.
Include, Lib and Scripts folders being part of virtualenv are not part of your project thus they should not be under vcs control. You might find PyCharm: versioning .idea folder while keeping different interpreters across developers interesting as well. In addition you might want to take a look at pip requirements file as a mean to recreate the same environment for your project on different computers.
I want to install python on a flash drive in a virtual environment so that I can develop code wherever I am. Is this possible to do in such a way that I can use my flash drive on windows/mac/linux computers?
For windows, head to Portable Python (http://PortablePython.com) to see various options you have,
For linux and Mac you don't need to install it on USB drive as those systems usually come with Python pre-installed. If you need specific packages for those systems, bring them on USB together with a command line script that can load them with one call in virtualenv on those systems and you are good to go !
Be aware that this is never 100% bullet proof as you are depending on Python version you are using/bringing packages for.
You could try looking at setting up something using some VirtualEnv type environments, with the various Python versions installed on your machines.
Not sure how you'd get round the different paths on the different operating systems though.
Virtualenv: http://pypi.python.org/pypi/virtualenv
As #millimoose pointed out, you could install three different versions of Python.
For each Python package you are working on, you can create a .pth file in the site-packages directory of each Python version that you would like to use the package from.
Note that, as described here:
If you put a .pth file in the site-packages directory containing a path, python searches this path for imports.
For example, if you have a package named my_package that you are working on that resides at the path C:\Users\Me\Documents\dev_packages\my_package, you can add a file with extension .pth (note that the name doesn't matter, specifically it doesn't have to have any relation to the package name), with the contents:
C:\Users\Me\Documents\dev_packages
This will add C:\Users\Me\Documents\dev_packages to the Python import search-path, causing the my_package package to be discovered. By placing this .pth file in the site-packages directory of each Python version, my_package will be available in all corresponding versions of Python.
my directroty sturcture is
/src (the source code directory including images)
/src/main.py (main script)
/src/subprojectfile/ (it consist of other several project file include __init__.py)
In my project I am using google procolbuffer,pygtk and other common python package like sys,time,thread etc..
I want to build an installer for non python system where user can install my application with out any python support.
For an alternative approach you might check out PyInstaller. It doesn't produce a proper installer, but rather standalone executables without external dependencies.
For windows you can use py2exe and for Linux have a look at freeze.
I have python as an embedded scripting environment in my application. I supply the python bits (python26.dll, DLLs & Lib folders) with my application. All this to avoid asking users to install python (you know how it goes in big corporations).
All works nice except pywin32. It installs pythoncom26.dll and pywintypes26.dll to the system32 directory. I want to keep these dlls in my Python directory. One option is to add my Python directory to the PATH env variable. But would like to avoid it for obvious reasons (windows DLL search path priorities issues).
Is there a way to tell Windows (a windows API is also fine) to look at my directories to load these pywin32 dlls? From what I understand these dlls get called by Windows COM.
Thanks.
Edit1:
Note that python is deployed embedded with my application.
I previously used py2exe to freeze the application and all the DLLs. Then use Innosetup to create an installer. Work like a charm.