Pages

Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Tuesday, March 18, 2014

Installing pillow on OS X Mavericks with Xcode 5.1

I've been doing some Python and Google App Engine development lately and I hit an issue with clang throwing an error like the following....
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -arch x86_64 -DHAVE_LIBJPEG -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -I/usr/local/include/freetype2 -IlibImaging -I/System/Library/Frameworks/Python.framework/Versions/2.7/include -I/usr/local/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.9-intel-2.7/_imaging.o

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

clang: note: this will be a hard error (cannot be downgraded to a warning) in the future

error: command 'cc' failed with exit status 1

The following discussion helped: https://stackoverflow.com/questions/22334776/installing-pillow-pil-on-mavericks I've had more issues with the March 2014 version of the Command Line Tools for Mavericks. Grrrr.

Thursday, January 02, 2014

Google App Engine\Python: Using the task queue with a reverse proxy or SSH tunnel

This is more a note for myself. When using forward, a SSH tunnel Ruby gem from the folks at forwardhq.com, Google App Engine\Python devserver will barf trying to resolve the Host header when dispatching tasks on the task queue. In my case, my tunnel hostname was coming through in the Host header, causing the KeyError in _port_registry.get(port) invocation.

dispatcher.py


  def _resolve_target(self, hostname, path):
    if self._port == 80:
      default_address = self.host
    else:
      default_address = '%s:%s' % (self.host, self._port)
    if not hostname or hostname == default_address:
      return self._module_for_request(path), None

    default_address_offset = hostname.find(default_address)
    if default_address_offset > 0:
      prefix = hostname[:default_address_offset - 1]
      # The prefix should be 'module', but might be 'instance.version.module',
      # 'version.module', or 'instance.module'. These alternatives work in
      # production, but devappserver2 doesn't support running multiple versions
      # of the same module. All we can really do is route to the default
      # version of the specified module.
      if '.' in prefix:
        logging.warning('Ignoring instance/version in %s; multiple versions '
                        'are not supported in devappserver.', prefix)
      module_name = prefix.split('.')[-1]
      return self._get_module_with_soft_routing(module_name, None), None

    else:
      if ':' in hostname:
        port = int(hostname.split(':', 1)[1])
      else:
        port = 80
      try:
        _module, inst = self._port_registry.get(port)
      except KeyError:
        raise request_info.ModuleDoesNotExistError(hostname)
        _module, inst = None, None
    if not _module:
      _module = self._module_for_request(path)
    return _module, inst

The line in red is the line that is barfing. Comment out the raise error line and set _module and inst to None, allowing execution to continue and the next line will test if _module hasn't been set and will go ahead and resolve it. Found the temporary fix from https://github.com/dylanvee/homebrew-gae_sdk. Hopefully this is something the GAE people can fix in upcoming versions of GAE\Python SDK.

Monday, November 04, 2013

Python Imaging Library (PIL) on OS X Mavericks

Upgraded to Mavericks (10.9) over the weekend, not taking into account my current Python/Google App Engine development work. Thus, this Monday morning, I'm spending some quality time getting my Python environment back up and running. One of the things that I needed to re-install in this new environment is PIL or the Python Imaging Library. Unfortunately, doing a naïve pip install results in an error when looking for an X11 header file. This StackOverflow comment solved my problem, so I'm sharing with others who might get hung up on PIL on Mavericks. The pre-built PIL stuff doesn't seem to install on Mavericks, so the pip install seems to be the way to go for 10.9/Mavericks.