Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(83)  |  Call(43)  |  Derive(0)  |  Import(40)
attempt to open a file or URL for reading

        def open_for_read(name,mode='b', urlopen=urlopen):
    '''attempt to open a file or URL for reading'''
    if hasattr(name,'read'): return name
    try:
        return open_for_read_by_name(name,mode)
    except:
        try:
            return getBytesIO(urlopen(name).read())
        except:
            raise IOError('Cannot open resource "%s"' % name)
        


src/d/j/django-admin-report-HEAD/example/lib/reportlab/pdfbase/ttfonts.py   django-admin-report(Download)
def TTFOpenFile(fn):
    '''Opens a TTF file possibly after searching TTFSearchPath
    returns (filename,file)
    '''
    from reportlab.lib.utils import rl_isfile, open_for_read
    try:
        f = open_for_read(fn,'rb')
                tfn = os.path.join(D,fn)
                if rl_isfile(tfn):
                    f = open_for_read(tfn,'rb')
                    return tfn, f
        raise TTFError('Can\'t open file "%s"' % fn)

src/d/j/django-admin-report-HEAD/example/lib/reportlab/platypus/flowables.py   django-admin-report(Download)
            # if it is a JPEG, will be inlined within the file -
            # but we still need to know its size now
            from reportlab.lib.utils import open_for_read
            f = open_for_read(filename, 'b')
            try:

src/d/j/django-admin-report-HEAD/example/lib/reportlab/pdfbase/pdfdoc.py   django-admin-report(Download)
from reportlab.pdfbase.pdfutils import LINEEND # this constant needed in both
from reportlab import rl_config
from reportlab.lib.utils import import_zlib, open_for_read, fp_str, _digester
from reportlab.pdfbase import pdfmetrics
try:
            import os
            ext = string.lower(os.path.splitext(source)[1])
            src = open_for_read(source)
            if not(ext in ('.jpg', '.jpeg') and self.loadImageFromJPEG(src)):
                if rl_config.useA85:

src/d/j/django-admin-report-HEAD/example/lib/reportlab/pdfbase/pdfutils.py   django-admin-report(Download)
    if filename==cachedname:
        if cachedImageExists(filename):
            from reportlab.lib.utils import open_for_read
            if returnInMemory: return filter(None,open_for_read(cachedname).read().split(LINEEND))
        else:

src/r/e/reportlab-3.1.8/src/reportlab/pdfbase/ttfonts.py   reportlab(Download)
def TTFOpenFile(fn):
    '''Opens a TTF file possibly after searching TTFSearchPath
    returns (filename,file)
    '''
    from reportlab.lib.utils import rl_isfile, open_for_read
    try:
        f = open_for_read(fn,'rb')
                tfn = os.path.join(D,fn)
                if rl_isfile(tfn):
                    f = open_for_read(tfn,'rb')
                    return tfn, f
        raise TTFError('Can\'t open file "%s"' % fn)

src/m/w/mwlib.ext-0.13.2/upstream-src/src/reportlab/pdfbase/ttfonts.py   mwlib.ext(Download)
def TTFOpenFile(fn):
    '''Opens a TTF file possibly after searching TTFSearchPath
    returns (filename,file)
    '''
    from reportlab.lib.utils import rl_isfile, open_for_read
    try:
        f = open_for_read(fn,'rb')
                tfn = os.path.join(D,fn)
                if rl_isfile(tfn):
                    f = open_for_read(tfn,'rb')
                    return tfn, f
        raise TTFError('Can\'t open file "%s"' % fn)

src/s/p/Spherebot-Host-GUI-HEAD/InkscapePortable/App/Inkscape/python/Lib/site-packages/sk1libs/libpdf/pdfbase/ttfonts.py   Spherebot-Host-GUI(Download)
def TTFOpenFile(fn):
    '''Opens a TTF file possibly after searching TTFSearchPath
    returns (filename,file)
    '''
    from reportlab.lib.utils import rl_isfile, open_for_read
    try:
        f = open_for_read(fn,'rb')
                tfn = os.path.join(D,fn)
                if rl_isfile(tfn):
                    f = open_for_read(tfn,'rb')
                    return tfn, f
        raise TTFError('Can\'t open file "%s"' % fn)

src/r/e/ReportLab-HEAD/src/reportlab/pdfbase/ttfonts.py   ReportLab(Download)
def TTFOpenFile(fn):
    '''Opens a TTF file possibly after searching TTFSearchPath
    returns (filename,file)
    '''
    from reportlab.lib.utils import rl_isfile, open_for_read
    try:
        f = open_for_read(fn,'rb')
                tfn = os.path.join(D,fn)
                if rl_isfile(tfn):
                    f = open_for_read(tfn,'rb')
                    return tfn, f
        raise TTFError('Can\'t open file "%s"' % fn)

src/i/e/iellos-HEAD/lib/reportlab/pdfbase/ttfonts.py   iellos(Download)
def TTFOpenFile(fn):
    '''Opens a TTF file possibly after searching TTFSearchPath
    returns (filename,file)
    '''
    from reportlab.lib.utils import rl_isfile, open_for_read
    try:
        f = open_for_read(fn,'rb')
                tfn = os.path.join(D,fn)
                if rl_isfile(tfn):
                    f = open_for_read(tfn,'rb')
                    return tfn, f
        raise TTFError('Can\'t open file "%s"' % fn)

src/m/a/mangareader-to-ebook-HEAD/reportlab/pdfbase/ttfonts.py   mangareader-to-ebook(Download)
def TTFOpenFile(fn):
    '''Opens a TTF file possibly after searching TTFSearchPath
    returns (filename,file)
    '''
    from reportlab.lib.utils import rl_isfile, open_for_read
    try:
        f = open_for_read(fn,'rb')
                tfn = os.path.join(D,fn)
                if rl_isfile(tfn):
                    f = open_for_read(tfn,'rb')
                    return tfn, f
        raise TTFError('Can\'t open file "%s"' % fn)

  1 | 2 | 3 | 4  Next