Forums

Sublime Text 2 plugin for Python Anywhere

Hello,

I've created a little plugin for editing files in Sublime Text 2 - PythonAnywhereEditor (watch 46 seconds screencast)

with this plugin you can:

  • create/open/edit/save file
  • reload webapps

mike.

Hey,

That's really cool. I haven't used Sublime Text, but I'll have a play

Cheers, Robert

How does it save the file to the pythonanywhere.com server? Do we have to mount a webdav folder or something?

How does it save the file to the pythonanywhere.com server?

send post request, such as from browser editor

Do we have to mount a webdav folder or something?

no, file loaded from server and saving in temp directory, when file close - temp file deleted

That's awesome, thanks for sharing that!

Wow, thanks kutu! Drop us an email at developers@pythonanywhere.com if there were any difficulties you had that we could make easier.

I think that there's an error in the current version. This line (111, of editor.py) settings.set("username", username) ought to be settings.set("username", new_username)

I've no real idea how to work github yet, otherwise I would have made a patch or something :)

edit created an issue on github :)

That is really cool, I'm sharing it everywhere. To the social media trenches people!

giryan, thx, fixed

hansel, you are welcome

2all, you also can set hotkey for reload webapps, in Preferences -> Key Bindings User just add this line:

[
    ...
    { "keys": ["ctrl+shift+r"], "command": "python_anywhere_reload" },
    ...
]

added two commands:

  • python_anywhere_sync_file - reload file content from server
  • python_anywhere_sync_opened_files - reload all opened files content from server

Hi all, for anyone that digs up this post, you should know that the "reload web app" part of the plugin is probably broken by our new multi-webapps api.

For anyone planning a pull request, our apologies the new api isn't very discoverable -- it uses a unique-id for the domain, which you can only really discover by looking at the button's forms on the webapps page, so you'd have to scrape the html -- eg:

<form class="reload_web_app" action="/user/yourusername/webapps/12345/reload" method="POST">

(note that that id, 12345, will change if you ever delete + re-create your app)

I'll add a little note for us to use a more friendly api...

+1 heads up and I'd like to express my sympathy for a pull request

fixed

add new command python_anywhere_web_apps_list

2pythonanywhere team, can you share with us stats about usage of this plugin

plugin send User-Agent: SublimeText2 - PythonAnywhereEditor

Hmm, yes of course. It's not showing up in our analytics. Which I think just means that we don't have to tracking code on the url that is being directly hit. Sounds like something I should have a play with when I get some spare time.

Definitely going to be using this! Sweet!

I tried to install this via package control but it doesn't show up. Is that because I'm using Sublime Text 3?

I wonder if kutu is still around to answer this question...

plugin not work on sublime3, because of python3

[2014-05-22 22:12:12.378000] login ... success

[2014-05-22 22:12:24.306000] open file /home/path/to/my.py ... unknown encoding: idna

How do I install sublime-text itself, before installing this plug-in?

It looks like python anywhere is using ubuntu 14.x, I looked up instructions for that and tried them. When I did I received these messages:

01:14 ~ $ sudo add-apt-repository -y ppa:webupd8team/sublime-text-2

sudo: unknown user: root

sudo: unable to initialize policy plugin

Thanks

SublimeText will not work on PythonAnywhere. The plugin is for a SublimeText running on your own computer that then connects to PythonAnywhere so you can edit your PythonAnywhere files in your local SublimeText.

hello , I need help. I can't save file using pythonanywhere plugin in sublime-2. Error when a can save character's "ã á ç ô",

/admin.py ... 'ascii' codec can't encode character u'\xe3' in position 135: ordinal not in range(128)

Top of my code:

!usr/bin/python

-- coding: utf-8 --

thank's.

Is there a full traceback? It's hard to debug that without a little more context.

The plugin provides only the information about the error, I was hoping that someone already had been through this .

Is admin.py the name of the file you're trying to save?

I don't see any server errors that indicate that the upload was attempted, so I'm inclined to think (admittedly on very little evidence) that the bug is in the plugin before it sends the content to the server. Perhaps you can raise an issue on github.