Showing posts with label pycharm. Show all posts
Showing posts with label pycharm. Show all posts

Tuesday, October 9, 2018

How do I enable the “Upload files to Remote Host” feature in the Before launch section of a PyCharm Run/Debug Configuration?

Leave a Comment

I'm running PyCharm Professional 5.0.4 and am referring to the feature described in the documentation here.

Upload files to Remote Host. Select this option to have the application files automatically uploaded to the server according to the default server access configuration. For more information, see Configuring Synchronization with a Web Server and Uploading and Downloading Files.

I have set a default Deployment (SFTP) and its mappings, and I can upload and download files via Tools->Deployment.. I have tried with the remote interpreter set to both the Deployment configuration and SSH Credentials.

I've tried every setting that seems to make sense, but "Upload files to Remote Host" never appears as an option in the Before launch section of my Run/Debug Configuration.

2 Answers

Answers 1

You can configure to run an external tool before launch using edit configuration window.

Combining it with this https://winscp.net/eng/docs/guide_automation to make batch file that automates file transfers to ftp or sftp servers, you can automate without using pycharm's automatic deployment feature. And here pycharm waits until the execution of external tool finishes to start the execution of the python script.

Answers 2

I have it auto-uploading when i save the project.

File > Settings > Build/Execution/Deployment > Deployment > Options > then about half way down there's a dropdown to upload changed files automatically to the server either always, on ctrl+s, or never.

In addition to the deployment settings, if you're doing remote interpreting then you'll need to set that up under File > Settings > Project: XXX > Project Interpreter > then click the cog in the top-right and choose Add Remote (Only available in the Pro version if anyone is wondering).

I think that's all you need.

Read More

Tuesday, March 15, 2016

How to use PyCharm for GIMP plugin development?

Leave a Comment

I need to develop a plugin for GIMP and would like to stay with PyCharm for Python editing, etc.

FYI, I'm on Windows.

After directing PyCharm to use the Python interpreter included with GIMP:

Project interpreter

I also added a path to gimpfu.py to get rid of the error on from gimpfu import *:

enter image description here

This fixes the error on the import, even when set to Excluded.

I experimented with setting this directory to Sources, Resources and Excluded and still get errors for constants such as RGBA-IMAGE, TRANSPARENT_FILL, NORMAL_MODE, etc.

enter image description here

Any idea on how to contort PyCharm into playing nice for GIMP plugin development?

Not really running any code from PyCharm, it's really just being used as a nice code editor, facilitate revisions control, etc.

1 Answers

Answers 1

As you find this variables are part of .pyd files (dll files for Python). PyCharm can't get signatures for content of this files.

For Python builtins (like abs, all, any, etc.) PyCharm has it's own .py files that uses only for signatures and docs. You can see it if you'll click on some of this funcs and go to it's declaration:

enter image description here

PyCharm will open builtins.py file in it's folder with following content:

def abs(*args, **kwargs): # real signature unknown     """ Return the absolute value of the argument. """     pass  def all(*args, **kwargs): # real signature unknown     """     Return True if bool(x) is True for all values x in the iterable.      If the iterable is empty, return True.     """     pass  def any(*args, **kwargs): # real signature unknown     """     Return True if bool(x) is True for any x in the iterable.      If the iterable is empty, return False.     """     pass 

As you see functions are defined and documented, but have no implementation, because their implementation created with C and placed somewhere in binary file.

Pycharm can't provide such wrapper for every library. Usually people who created .pyd files provide their .py wrappers (for example, PyQt module: no native python implementation, just signatures).

Looks like Gimp doesn't have such wrapper for some of variables. Only way I see is to create some sort of own wrapper manually. For example, create gimpfu_signatures.py with following content:

RGBA_IMAGE = 1 TRANSPARENT_FILL = 2 NORMAL_MODE = 3 

And import it while you're creating plugin:

from gimpfu import * from gimpfu_signatures import *  # comment on release 

Not elegant, but better then nothing.

...

One more note about gimpfu.py's path. If I understand correctly, you just added this path to project. It may work, but correct way is to add it to project's PYTHONPATH (in project preferences). See this link for detailed manual.

Read More