Monday, January 19, 2015

Python: ImportError: No module named mandrill

I installed mandrill using pip:

    (venv)Jhons-MacBook-Pro:venv jhonjairoroa87$ pip install mandrill

I got this result:

    Downloading/unpacking mandrill
    Downloading mandrill-1.0.57.tar.gz
    Running setup.py (path:/private/var/folders/x3/st96cn215h915kqwlcrmtspw0000gn/T/pip_build_jhonjairoroa87/mandrill/setup.py) egg_info for package mandrill
    Requirement already satisfied (use --upgrade to upgrade): requests>=0.13.2 in /usr/local/lib/python2.7/site-packages (from mandrill)
    Requirement already satisfied (use --upgrade to upgrade): docopt==0.4.0 in /usr/local/lib/python2.7/site-packages (from mandrill)
    Installing collected packages: mandrill
    Running setup.py install for mandrill
    changing mode of build/scripts-2.7/mandrill from 644 to 755
    changing mode of build/scripts-2.7/sendmail.mandrill from 644 to 755
    changing mode of /usr/local/bin/mandrill to 755
    changing mode of /usr/local/bin/sendmail.mandrill to 755
    Successfully installed mandrill
    Cleaning up...


But when I try to use it, fails:

    (venv)Jhons-MacBook-Pro:venv jhonjairoroa87$ python
    Python 2.7.6 (default, Sep  9 2014, 15:04:36)
    [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import mandrill
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ImportError: No module named mandrill
    >>>
    >>> import sendmail.mandrill
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ImportError: No module named sendmail.mandrill


I solved it by uninstalling it

     pip uninstall mandrill

and reinstalling it using the python -m option:

    sudo python -m pip install mandrill

Now it works perfectly.

    (venv)Jhons-MacBook-Pro:python_mandrill jhonjairoroa87$ python
    Python 2.7.6 (default, Sep  9 2014, 15:04:36)
    [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import mandrill
    >>>


Reference:
http://stackoverflow.com/questions/28032356/importerror-no-module-named-mandrill/28032480

Thursday, January 15, 2015

Codeship - heroku continous deployment: Push failed: could not store slug!

Trying to deploy automatically form codeship to heroku I was getting the error:

-----> Compressing... done, 72.0MB
-----> Launching...!     
Push failed: could not store slug!     
If the problem persists, see http://help.heroku.com and provide Request ID 

I solved the issue by adding the heroku url project and enable the "force push" flag in the option: Project settings > Deployment > Heroku Deployment > more options.

Reference:
http://stackoverflow.com/questions/9794413/failed-to-push-some-refs-to-githeroku-com

Wednesday, January 14, 2015

Python: "command python setup.py egg_info failed with error code 1" while trying to install psycopg2

Using MacOSX I was trying to install psycopg2 by using the command,

sudo pip install psycopg2

And I was getting this error:

command python setup.py egg_info failed with error code 1

I solved the issue by installing http://brew.sh/ and running following commands:

brew install python
brew install postgres

References:
http://stackoverflow.com/questions/5420789/how-to-install-psycopg2-with-pip-on-python

Monday, December 1, 2014

Auth0: Configuring facebook error : Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.

Configuring the auth0 - facebook access I was getting this error:

"Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains."     

I solved that issue going to the Facebook App page, click "edit App" then click "Advanced" in the left-hand navigation. Then for "Valid OAuth redirect URIs" add the auth0 app domain ie: (jhonapp.auth0.com).

Resources:
http://stackoverflow.com/questions/20910576/how-can-i-add-localhost3000-to-facebook-app-for-development   

Monday, November 24, 2014

Nearpy - Scypy installation error on Mac OS: library dfftpack has Fortran sources but no Fortran compiler found

Run the following commands:

1. install homebrew:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


2. Install GCC: GNU Fortran is now provided as part of GCC, and can be installed with: brew install gcc.

brew install gcc

That's it, now try to install Scypy again, everything should work smoothly.

Resources:
http://stackoverflow.com/questions/14821297/scipy-build-install-mac-osx
http://penandpants.com/2012/03/01/install-python-2/

Wednesday, November 12, 2014

Angularjs update migration : getting function parameters from template

Using angular 1.2.0-rc.3 with this code

// html 
...
<div ng-repeat="row in rowdata">
   <a ng-click="getDetailedListing('{{row._id.$oid}}');">Details</a>
</div>
...

//angular js controller
$scope.getDetailedListing = function(listingId) {
        console.log(listingId);
}

When the user clicks the 'a' element, in the console is printed the listingId ie. 54613ed26fb36f26e5ab41a8

But when we upgrade the angular version to 1.2.26, the same code printed {{row._id.$oid}} instead of the listing id. So the fix was changing the a element a little bit:

<a href="javascript:;" ng-init="listingId=row._id.$oid" ng-click="getDetailedListing(listingId);" >Details</a>

Reference
http://stackoverflow.com/questions/18694827/calling-a-scope-function-from-an-ng-include-template-passing-template-value-as-p

Pycharm: exit code 69 trying to run git command

I was getting the error:

exit code of #69 Additional error details: Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

I solved it by installing Xcode, running it, accept the user agreement, let it install everything and reload Pycharm.

Source:
http://nielsvanrongen.com/bower-exit-code-of-69/