ImportError : No module named options.pipeline_options - python-2.7

This is the error screenshot, click
i want to run a wordcount program using dataflow in python 2.7 on gcloud SDK
i have used the path to import the PipelineOptions,
Here are two approaches-
1.from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.options.pipeline_options import SetupOptions
2.from apache_beam.pipeline import PipelineOptions
from apache_beam.pipeline import SetupOptions
but it still show 'ImportError: No module named options.pipeline_options' in both of the approaches which i try.
there is any solution in apache_beam or in python 2.7 ?

Related

I am trying to import gensim, pandas and numpy in my django project but getting import error

I am getting an import error as i try to import gensim, pandas and numpy in django views.py . It works fine in shell.
How can I import them in views.py. I have installed the libraries in virtual environment.

No module name found

I had created a python file which will pull the data from app dynamics for which i had imported the package from appd.request import AppDynamicsClient
it is working fine but now i want to convert it into .exe for which i am using py2exe in py2exe i am trying to include the package appdynamics but it is giving error package not found
from appd.request import AppDynamicsClient
from matplotlib.dates import date2num
import matplotlib.dates as dates
import matplotlib.pyplot as plt
import requests
these are the packages i am importing in main file which i am trying to convert it into .exe file
setup.py file
from distutils.core import setup
from distutils.core import setup
import py2exe
setup(console=['AD_API.py'],
options = {
"py2exe": {
'packages' :['requests','AppDynamicsClient','matplotlib']
}
}
)
ERROR MESSAGE:
ImportError: No module named AppDynamicsClient

py2exe compiled .exe won't start

I compiled my prototype Application with py2exe to check its function as an exe, and run into 0 errors until I go to start it. Nothing happens. A process starts with my app name, it thinks for a few seconds, then nothing. No log file is generated. The app works great when run in python environment, but not in the compiled exe. I've given my setup code below. Any ideas? :
from distutils.core import setup
import py2exe, sys, os
import matplotlib
import FileDialog
import dateutil
sys.argv.append('py2exe')
setup( windows=['ATLAS.pyw'], data_files=matplotlib.get_py2exe_datafiles(),
options = {"py2exe": {
"includes": "decimal, datetime",
"packages": ["FileDialog", "dateutil"],
'bundle_files': 2,
'compressed': True}
},
zipfile = None
)
Hooks utilized in the Application:
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from matplotlib.backend_bases import key_press_handler
from pandas.sandbox.qtpandas import DataFrameWidget
from matplotlib.widgets import LassoSelector
from tkFileDialog import askopenfilename
from matplotlib.figure import Figure
import matplotlib.image as mpimg
from PySide import QtGui, QtCore
from matplotlib.path import Path
import pandas.io.sql as psql
from numpy import nonzero
import tkMessageBox as mb
from pylab import *
import pyodbc
import sys
import ttk
SOLVED:
So, using quick fingers (and compiling it with PyInstaller with the --debug option) I screen-capped the quickly-closing console window that contained the Traceback:
WindowsError: [Error 3] The system cannot find the path specified: 'C:\\path\\dateutil\\zoneinfo/*.*'
The zoneinfo file was being saved in pytz instead of dateutil. A quick rename solved the problem.
Only issue though, if you want to compile with -F or --onefile it will not work due to the initial improper naming convention. Not quite sure how to fix that though.

Unable to import Django models in python script

My code is here.
I have tried different approach from stackoverflow and non of them worked.
import os
import sys
from django.conf import settings
sys.path.append('/var/www/iaas/horizon')
sys.path.append('/var/www/iaas/horizon/openstack_dashboard')
os.environ['DJANGO_SETTINGS_MODULE'] = 'openstack_dashboard.settings'
from bill.models import MonthlyBills
from django.contrib.auth import models
If I run python daemonize.py, here is the error message I get.
I am confused because I have already included my django project path in my sys.path
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'openstack_dashboard.settings' (Is it on sys.path?): cannot import name connection
What I am trying to achieve is to create a python-daemon, I need to have an access in my django models.
I hope someone who could point me where I am mistaking here.
You have to set up os.environ['DJANGO_SETTINGS_MODULE'] before you import settings.
The process of importing django.conf.settings will look to see if the DJANGO_SETTINGS_MODULE environment variable is set before determining white settings to load.
import os
import sys
sys.path.append('/var/www/iaas/horizon')
sys.path.append('/var/www/iaas/horizon/openstack_dashboard')
os.environ['DJANGO_SETTINGS_MODULE'] = 'openstack_dashboard.settings'
from django.conf import settings

scrapy-linkedin for LinkedIn data extraction

I'm using scrapy-0.16 for data extraction from LinkedIn.
from scrapy.selector import HtmlXPathSelector
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.http import Request
from scrapy import log
from linkedin.items import LinkedinItem, PersonProfileItem
from os import path
from linkedin.parser.HtmlParser import HtmlParser
import os
import urllib
from bs4 import UnicodeDammit
from linkedin.db import MongoDBClient
https://github.com/pondering/scrapy-linkedin
The error comes
Traceback (most recent call last):
File "C:\Users\TAWANE DUDEZ\Desktop\linkedin\linkedin\spiders\LinkedinSpider.py", line 6, in <module>
from linkedin.items import LinkedinItem, PersonProfileItem
ImportError: No module named linkedin.items
Cannot find linkedin.items module.
My suspicion is that you're trying to run the scrapy crawl LinkedinSpider command from the wrong directory. Try navigating to C:\Users\TAWANE DUDEZ\Desktop\linkedin and then running the command again.
Since the crawler is now starting, you also need to be running a MongoDB instance before starting the crawl. The README of the github project being used says to typemongod to start an instance. Just to check, you do have MongoDB and pymongo installed right?