omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. Matthew_Murdoch187

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 5
    • Best 0
    • Controversial 0
    • Groups 0

    Matthew_Murdoch187

    @Matthew_Murdoch187

    0
    Reputation
    731
    Profile views
    5
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Matthew_Murdoch187 Unfollow Follow

    Latest posts made by Matthew_Murdoch187

    • RE: Access your Github Account from Pythonista

      I have upgraded the underlying version of PyGithub to fix a github connectivity issue. You can still install the script from: https://gist.github.com/4026453.

      Note that this script attempts to delete directories (Folders) called 'temp' and 'dateutil' within Pythonista as part of installation. It will also overwrite files in directories named 'github' and 'githubista'. If you are using Pythonista 1.3 or above please check that you have not created any Folders with these names before running this script as any files inside them will be irretrievably lost.

      posted in Pythonista
      Matthew_Murdoch187
      Matthew_Murdoch187
    • Access your Github Account from Pythonista

      If you have a Github account and would like to access it from Pythonista here's a script to download and install PyGithub: https://gist.github.com/4026453

      It creates 'github' and 'dateutil' directories in Pythonista's Documents directory which you can import as modules. These aren't visible through the UI but can be seen for example by running @wrenoud's fantastic file browser (see http://omz-software.com/pythonista/forums/discussion/19).

      An example use of the PyGithub module (which authenticates a Github user and lists the files in their public and private repositories) can be found here: https://gist.github.com/4051357

      PyGithub provides a full implementation of the Github v3 API. For browsing operations the API is fairly self explanatory but for committing changes it is somewhat obfuscated (http://developer.github.com/v3/git/ is the best resource for help with understanding this). In principle, though, a fully featured Github client could be built on top of this implementation.

      Some caveats:

      1. I've patched the original PyGithub to use dateutil rather than strptime as I get errors the second time strptime is called (a quick google suggests that this is a fairly common problem). It's this patched version which is downloaded and installed, although you can try the original by reading the comments embedded in the script if you'd like. This is also the reason that dateutil is installed - the original PyGithub library has no dependency on it.
      2. Beyond the simple example script I've not validated that all Github functionality works.
      posted in Pythonista
      Matthew_Murdoch187
      Matthew_Murdoch187
    • RE: Access your Github Account from Pythonista

      I have added to this library to provide some easier to use (and useful) functionality. There are still a large number of issues (see below) but as I am already finding the limited functionality of use I thought I'd share it.

      Download and install the library from https://gist.github.com/4026453

      Once installed, to clone a github repository, simply run the following script. It will prompt for your github credentials and the name of the repository you want to clone.
      <pre>
      import githubista

      githubista.clone()
      </pre>
      The repository is cloned to a directory with the same name. To access the files within you will need to use a file browser tool such as the one linked to above.

      Once you've made changes to a script file you can commit the changes by running the following script from the actions menu:
      <pre>
      import githubista

      githubista.commit()
      </pre>
      This script will ask for credentials again (although remembers the previously entered ones) and also asks for the commit message.

      Issues:

      1. Only the master branch is cloned - you cannot currently choose a different branch
      2. Only a single file can be committed at a time
      3. Only a flat structure is supported - no directories can exist within a repository
      4. No version history is currently saved to Pythonista - this will likely need to change as this progresses
      5. Only python (.py) files can be edited (and therefore changed and committed)

      If you'd like to contribute to this library, please fork on github: https://github.com/mmurdoch/githubista

      posted in Pythonista
      Matthew_Murdoch187
      Matthew_Murdoch187
    • RE: Crude HitTest

      This works really nicely - thanks!

      posted in Pythonista
      Matthew_Murdoch187
      Matthew_Murdoch187
    • RE: Problem with strptime()

      I encountered the same problem. After struggling to get either datetime.strptime or time.strptime to work consistently without error I gave up and downloaded dateutil.

      The dateutil module also has the benefit that you shouldn't need to work out the format string. Assuming that dateutil supports your date format your example code could be written as:

      from dateutil import parser

      obstimedt = parser.parse(obstime)

      If you're interested in using dateutil then you can download it using this script: https://gist.github.com/4026516 (note that this script creates a 'temp' and a 'dateutil' directory alongside your Pythonista scripts - although the 'temp' directory gets deleted after download).

      posted in Pythonista
      Matthew_Murdoch187
      Matthew_Murdoch187