¡@

Home 

python Programming Glossary: imp

How to check if a python module exists without importing it

http://stackoverflow.com/questions/14050281/how-to-check-if-a-python-module-exists-without-importing-it

to check if a python module exists without importing it I need to know if a python module exists without importing.. it I need to know if a python module exists without importing it. Importing something that might not exist not what.. something that might not exist not what I want try import eggs except ImportError pass python python import share..

how to reference python package when filename contains a period

http://stackoverflow.com/questions/1828127/how-to-reference-python-package-when-filename-contains-a-period

to do the following idea in models.py from models.admin import however I get a syntax error for having double quotes. But.. having double quotes. But if I just do from models.admin import then I get ImportError No module named admin Is there any.. get ImportError No module named admin Is there any way to import from a python file that has a period in its name python..

How to load compiled python modules from memory?

http://stackoverflow.com/questions/1830727/how-to-load-compiled-python-modules-from-memory

python 2.5.2 on windows TIA Steve python module share improve this question It depends on what exactly you have as the.. as built by cat 'ciao.py' def ciao return 'Ciao ' python c'import ciao print ciao.ciao ' Ciao IOW having thus built ciao.pyc.. b 200 and your goal is to go from that byte string b to an importable module ciao . Here's how import marshal c marshal.loads..

Return a list of imported Python modules used in a script?

http://stackoverflow.com/questions/2572582/return-a-list-of-imported-python-modules-used-in-a-script

a list of imported Python modules used in a script I am writing a program.. categorizes a list of Python files by which modules they import. As such I need to scan the collection of .py files ad return.. of .py files ad return a list of which modules they import. As an example if one of the files I import has the following..

Python, import string of Python code as module

http://stackoverflow.com/questions/3614537/python-import-string-of-python-code-as-module

import string of Python code as module In python you can do something.. as module In python you can do something like this to import a module using a string filename and assign its namespace.. its namespace a variable on the local namespace. x __import__ str I'm wondering if there is a related function that will..

Dynamically importing Python module

http://stackoverflow.com/questions/3799545/dynamically-importing-python-module

importing Python module I have a trusted remote server that stores.. the fetched module code to the local hard disk. How can I import the code as a fully operable Python module including its.. operable Python module including its global variables and imports I suppose I have to use some combination of exec and imp..

Access django models inside of Scrapy

http://stackoverflow.com/questions/4271975/access-django-models-inside-of-scrapy

really get how to set it up python django scrapy share improve this question If anyone else is having the same problem.. to my scrapy settings.py file def setup_django_env path import imp os from django.core.management import setup_environ f.. scrapy settings.py file def setup_django_env path import imp os from django.core.management import setup_environ f filename..

SOAP suds and the dreaded schema Type Not Found error

http://stackoverflow.com/questions/4719854/soap-suds-and-the-dreaded-schema-type-not-found-error

the workaround it still doesn't work. from suds.client import Client from suds.xsd.sxbasic import Import url 'file wsdl.wsdl'.. work. from suds.client import Client from suds.xsd.sxbasic import Import url 'file wsdl.wsdl' Import.bind 'http schemas.xmlsoap.org.. yields the exception above. python soap suds share improve this question We got it working and I hope you did as..

Is there a standard way to list names of Python modules in a package?

http://stackoverflow.com/questions/487971/is-there-a-standard-way-to-list-names-of-python-modules-in-a-package

seems like a fair amount of work for something the module import mechanism is already doing internally. Is that functionality.. exposed anywhere python module package share improve this question Maybe this will do what you're looking for.. this question Maybe this will do what you're looking for import imp import os MODULE_EXTENSIONS '.py' '.pyc' '.pyo' def package_contents..

Load module from string in python

http://stackoverflow.com/questions/5362771/load-module-from-string-in-python

module out of it without writing to disk. When I try using imp and a StringIO object to do this I get imp.load_source 'my_module'.. I try using imp and a StringIO object to do this I get imp.load_source 'my_module' '' StringIO 'print hello world ' Traceback.. TypeError load_source argument 3 must be file not instance imp.load_module 'my_module' StringIO 'print hello world ' '' ''..

python: importing from builtin library when module with same name exists

http://stackoverflow.com/questions/6031584/python-importing-from-builtin-library-when-module-with-same-name-exists

importing from builtin library when module with same name exists.. class from the Python libraries When I use from calendar import Calendar it complains because it's trying to load from my.. to avoid writing the name of the module all the time when importing a module in python Any ideas without having to rename..

How to import a module given the full path?

http://stackoverflow.com/questions/67631/how-to-import-a-module-given-the-full-path

to import a module given the full path How can I load a Python module.. is a configuration option. python configuration share improve this question import imp foo imp.load_source 'module.name'.. python configuration share improve this question import imp foo imp.load_source 'module.name' ' path to file.py'..

Suds Error: BadStatusLine in httplib

http://stackoverflow.com/questions/7725693/suds-error-badstatusline-in-httplib

Here is the code used to create the client imp Import 'http www.w3.org 2001 XMLSchema' imp.filter.add 'http.. the client imp Import 'http www.w3.org 2001 XMLSchema' imp.filter.add 'http tempuri.org encodedTypes' imp.filter.add 'http.. XMLSchema' imp.filter.add 'http tempuri.org encodedTypes' imp.filter.add 'http tempuri.org ' self.doctor ImportDoctor imp..

Saving Django model from Scrapy project

http://stackoverflow.com/questions/7883196/saving-django-model-from-scrapy-project

a Django model definition I am not using DjangoItem . I am importing Django settings as specified here . def setup_django_env.. settings as specified here . def setup_django_env path import imp os from django.core.management import setup_environ f.. as specified here . def setup_django_env path import imp os from django.core.management import setup_environ f filename..