Questions tagged [python-2.7]

32913 questions
1

votes
1

answer
49

Views

How do I get the words in alphabetical order and remove the symbol u'?

I am working on creating a bag of words. I referred to this link https://pythonprogramminglanguage.com/bag-of-words/#respond df = pd.read_csv('Twidb11.csv',error_bad_lines=False, sep='delimiter', engine='python') # Creating Bag of Words count_vect = CountVectorizer() X_train_counts = count_vect.fit...
kavya sharma
1

votes
0

answer
145

Views

Python/Kivy : How to pass TextBox value in .kv file from one class to another class

Can anyone tell me? I have two file test.py and test.kv. I have a textBox which id : state . How to pass state.text value in root.get_value(state.text) and get value in function of def get_value test.py from kivy.uix.screenmanager import Screen from kivy.app import App from kivy.lang import Builder...
Martin
1

votes
0

answer
141

Views

Can I use tkinter's destroy to close easygui msgbox?

I have to have a msgbox close after a few seconds in easygui, but the user has to click 'ok' first. Can I use tkinter's destroy to close the window, if it is an easygui window? If so, how would I do this?
Brandon
1

votes
0

answer
238

Views

Geckodriver error when script runs from cronjob

I have python script which run absolutly fine when we execute it manually. However when we schedule it to run from cronjob it fails with driver = webdriver.Firefox(firefox_profile=profile) File '/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py', line 148, in __init__ s...
Jaydeep Chaudhari
1

votes
1

answer
520

Views

Applying Butterworth High Pass Filter

I have a problem with applying Butterworth High Pass Filter to my data. I would like to print filter for Bx and By matrix. As you can see I have both positive and negative values, how to apply math.fabs() to Bx and By to get only positive values? For my high pass filter I have those requirements: F...
Hiddenguy
1

votes
1

answer
213

Views

Python-for-android error: local variable 'targets' referenced before assignment

I keep getting an error when trying to create an apk with python-for-android. When I run this: p4a apk --debug --sdk_dir=sdk --ndk_dir=ndk --ndk_version=r16b --private mnt/c/main.py --package=helloworld --name 'Hello World' --version 0.1 --bootstrap=sdl2 --requirements=python2,kivy --arch=armeabi-v...
Sachit Gali
1

votes
0

answer
5

Views

Getting error when setting listen() value on my socket

I am trying to allow up to 5 connections to my socket. Thus, I read I need to use the listen() function. To my understanding if I put listen(5), it means there can be at most 5 connections at any given point in time. However, I I try and run my program, I get an error. I am using Python 2.7.13 serve...
Mary
1

votes
0

answer
419

Views

AttributeError: 'module' object has no attribute 'RAND_LIMIT' while running Box2d with OpenAI gym

I have installed box2d using pip install but when I run OpenAI gym environment for box2d games with python. In my case I am trying to run LunarLander environment:- import gym env = gym.make('LunarLander-v2') env.reset() I get this error: [2018-01-02 01:37:39,026] Making new env: LunarLander-v2 Trac...
Yograj Singh Mandloi
1

votes
1

answer
297

Views

tab completion not working

I'm trying to create a prompt with tab completion. I have two files. main.py and prompt.py. main.py imports prompt.py and runs prompt.py's main() function. The main() function sets up a tab completer using readline and repeatedly waits for user input. It prints whatever is inputted and should have t...
eclipse
1

votes
2

answer
61

Views

User input of right ascension and declination

I thought that this would be easy but ... I want the user to input both right ascension and declination and then later in the program I will act on their input. Here is the problem, I know how to allow the user to input declination or right ascension in decimal format (let's say declination = +29.9...
Walter
1

votes
1

answer
62

Views

Error in the algorithm of ordering nodes in the undirected graph

The idea is to construct a list of the nodes in the undirected graph ordered by their degrees. Graph is given in the form {node: (set of its neighbours) for node in the graph} The code raises KeyError exception at the line 'graph[neighbor].remove(node)'. It seems like the node have already been del...
Ay Zu
1

votes
0

answer
33

Views

How to add another column in the text file?

I have made a text file which has words and their occurrences in a tweet. The text file looks like W1 W2 W2 .. 1 0 0 .. where W1= word 1 I want to add another column after the Wn which be the time the tweet was extracted. I have the time in another text file. My Code: df = pd.read_csv('Twidb11...
kavya sharma
1

votes
0

answer
74

Views

Why does zip password cracker show strange/invalid passwords

This script tries to open the password-protected file arch.zip, using words from words.txt, which is a list of 476k English words. The password is 'passwordy' and I have added this twice to words.txt, once near the beginning and once as the final word of the file. with open('words.txt', 'r') as the_...
DarkLink
1

votes
0

answer
181

Views

Jedi python autocomplete not working

I've installed Jedi Python Autocomplete package for Sublime Text 3. When I installed it, it worked fine. When I saved a file as .py Jedi stop working. When I restart Sublime Text, Jedi doesn't work. Question: Any suggestions?
sooaran
1

votes
0

answer
183

Views

python/kivy : set dynamically value on on_touch_down event in TextInput from treeView

I have two files test1.py and test1.kv. There are a +Add more button.When click on +Add More button then row add dynamic. I added treeView on TextInput.But now i am confused that how to put selected treeView value(self.text) in current TextBox because every TextBox added dynamic so i don't know how...
Martin
1

votes
1

answer
61

Views

python: subprocess gives me different results while using sudo

I'm using python to do some tests and I get a very weird issue as below: First I have a simple bash script named 1.sh: #!/bin/sh echo 'NOTHING' Then I make such a python script named test.py in the same directory as below: #!/usr/bin/python import subprocess import os os.environ['PS4'] = 'aaa ' res=...
Yves
1

votes
0

answer
87

Views

pypy heapq c implementation

Why is the c module for heapq not available to pypy, and what can I do to make it available? i.e. Python 2.7.13 (c5b147d52043, Jan 01 2018, 23:13:26) [PyPy 5.11.0-alpha0 with GCC 6.3.0 20170516] on linux2 Type 'help', 'copyright', 'credits' or 'license' for more information. And now for something co...
channon
1

votes
0

answer
142

Views

Plotly Choropleth showing no output

I was trying to plot choropleth map using plotly but getting a blank output.I am not getting any map.here is my code- input- import plotly.plotly as py from plotly.offline import download_plotlyjs,init_notebook_mode,plot,iplot import plotly.graph_objs as go init_notebook_mode(connected=True) %matplo...
1

votes
0

answer
260

Views

Flask Restful Reqparse required=True Error handling

I am using flask_restful.reqparse for parsing arguments. Now I want 'name' argument must be required. So I wrote this: from flask_restful import reqparse parser = reqparse.RequestParser() name= parser.add_argument('name', required=True, help='name is missing') Now I want to handle error that name is...
Parth Chauhan
1

votes
1

answer
523

Views

Find the most common row across multiple columns

I have a pandas dataframe with an identifying column (Name) and three value columns (A, B, C). df = pd.DataFrame({'Name': ['John', 'John', 'John', 'John', 'John', 'Sam', 'Sam', 'Sam'], 'A': [1, 1, 1, 2, 2, 3, 3, 3], 'B': [1, 1, 2, 2, 2, 3, 4, 3], 'C': [2, 1, 1, 1, 1, 3, 3, 3]}) For each name, I wan...
T Walker
1

votes
1

answer
52

Views

counting number of new values per month in pandas dataframe

I have a huge list(pandas dataframe) that looks like this user userID Date 1/1/2018 Annual 12345 1/3/2018 Annual 12345 1/5/2018 One Time 1/11/2018 One Time 1/12/2018 One Time 1/13/2018 Annual 98765 . . 2/1/2018 Annual 12345 2/3/2018 Annual 12345...
Hirotaka Nakagame
1

votes
1

answer
531

Views

cannot open shared object file: No such file or directory in raspberry pi with python

Here I am trying to import 'libEpsonFiscalDriver.so' file in raspberry pi using python 2.7. Here are my steps in python >>>import ctypes >>>ctypes.cdll.LoadLibrary('/home/pi/odoo/my_module/escpos/lib/libEpsonFiscalDriver.so') Traceback (most recent call last): File '', line 1, in File '/usr/lib/pyt...
Parth N Patel
1

votes
0

answer
68

Views

How to filter objects in django based on json field where a key is list and based on number of list items mathched for each object?

I have a an object named canditade. class Candidate(models.Model): name = models.CharField(max_length=64) skills = models.JSONField() I have created objects like this Candidate.objects.create(name='mark',skills={'list':{'name':'python'}, {'name':'java'}, {'name':'sql'}, {'name':'django'} }) Candidat...
Arbaz Hundekar
1

votes
1

answer
46

Views

Use user input and configfile to write to a new file

I am pretty new to coding, and I am attempting to have a user input words (zones). I want these to be put into a list that can be used to pull from based on the counter. The rest of the input is being pulled from a file and then then broken up using shlex.split. I'm then naming these linetokens and...
Dustin Burmeister
1

votes
0

answer
401

Views

Python site-packages folder: recommended location, ownership, group, and permissions?

I am using python 2.7.10 and python 3.4.2 on mac osx 10.10.5. Previously I just installed python packages using sudo pip install without thinking much about it, but recently I ran into trouble. Some packages didn't want to install (some errors I don't recall), so my colleague suggested to update pip...
desserts
1

votes
1

answer
559

Views

python proxy in selenium firefox headless not working

I am using Ubuntu Server 17.04. I am trying to set my proxy into selenium. But it's not working. I am using proxy from https://stormproxies.com/. Basically only the ip i allowed it will be allowed to have proxy and then i have to use the ip that they give me to access it. So basically it's not anyth...
Omega
1

votes
2

answer
119

Views

why math.ceil return a integer in flask shell command?

ENV: python: 2.7.5 flask = 0.12.2 flask-cors = 2.0.1 flask-script = 2.0.5 start a python shell: $ python Python 2.7.5 (default, Nov 6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2 Type 'help', 'copyright', 'credits' or 'license' for more information. >>> import math >>> math.cei...
pangpang
1

votes
1

answer
310

Views

Parsing xml in python gives null values

I'm programming in python and I'm trying to read the status of my Yamaha network stereo. I get the following xml response On All good so far. Now, I'm trying to search for Power to get the latest status. It is there in XML but I can't locate the Power Status value when I use a XML parser such as...
Tony De La Rosa
1

votes
0

answer
46

Views

In Python multiple mysql db communication using ORM

Good day to All, I need to communicate to DBs like here is the sample using python & peewee. First i need to put an entry in the types table of the MainDb. only the Name & type am having & the ID will get auto increment after the entryin the table, then using the auto incremented id(MainID), i need...
user7014262
1

votes
1

answer
166

Views

How to Evaluate Inequality inside a String in Python 2

I have a text file (an output of a different process that I can't alter) which contains logical comparisons (only these three: >, second elif operation == '
FatihAkici
1

votes
0

answer
63

Views

Python uncaught exception

I've got two programs written in Python2 running on Raspberry Pi, but my question strictly concerns Python. First program detects temperature and prints its value on a 16x2 LCD, while the second one is controlled by an IR remote which is used for toggling LEDs. Both programs use similar try/except m...
dominikbrandon
1

votes
1

answer
955

Views

Error: AttributeError: Movie instance has no attribute 'show_trailer'

I made first folder for Class Movie: import webbrowser class Movie(): def __init__(self,movie_title,movie_storyline,poster_image,trailer_youtube): self.title=movie_title self.storyline=movie_storyline self.poster_image_url=poster_image self.trailer=trailer_youtube def show_trailer(self): webbrowser....
AbdalRahman Farag
1

votes
1

answer
277

Views

Cannot create Virtualenv in Python

I'm struggling with virtualenv in Python. After virtualenv _env I get: Running virtualenv with interpreter /usr/bin/python2 New python executable in /home/marcin/Documents/Projects/django_tutorial/_env/bin/python2 Also creating executable in /home/marcin/Documents/Projects/django_tutorial/_env/bin/p...
bigmeister
1

votes
0

answer
133

Views

ee.mapclient with python 2.7 and Anaconda, possible alternatives?

I have installed the google earth engine python APIs in my MAcOS where also Anaconda is installed. I got problem with the object ee.mapclient. I made it working modifying the line of the import using from PIL import Image, ImageTk Now it does not produce error message but it is not working either....
rduca
1

votes
0

answer
23

Views

What is PPXSZN in PDF char details. for example. <type 'list'>: ['PPXSZN', 'Arial,Bold']

Pdf uses : ['PPXSZN', 'Arial,Bold'] kind of array to store char font details. Here What is this PPXSZN stands for? I use pdf miner to extract this.
DooDU
1

votes
0

answer
512

Views

Read first line of huge Json file with Spark using Pyspark

I'm pretty new to Spark and to teach myself I have been using small json files, which work perfectly. I'm using Pyspark with Spark 2.2.1 However I don't get how to read in a single data line instead of the entire json file. I have been looking for documentation on this but it seems pretty scarce. I...
Sleenee
1

votes
1

answer
168

Views

How to import modules when modules have same folder names,

I'm facing an issue where google.appengine and google.cloud python modules are under different directories named google Their following paths are as below: 1st Path: C:\Users\MohammedT\Desktop\dsapp\sitepackages\dev\google_appengine api_server.py appcfg.py backends_conversion.py BUGS bulkloader.py b...
Tameem
1

votes
2

answer
3.9k

Views

Install requirements.txt with pip

I am trying to install remote environment like on remote server using requirements.txt. So first I went to Server went to virtualenv by source bin/activate and typed: pip freeze > requirements.txt then on my Windows machine I run: pip2 install -r requirements.txt I have currently Python27 on Serve...
Ivan
1

votes
0

answer
192

Views

python to exe use pyinstaller module comtypes get error

anyone. When I debugging python the code works very well , but when I made it as an EXE file using pyinstaller : pyinstaller test.py when i run the exe file it occurs error is : No such file or directory: c:\Db\dist\test\gen\_00020905_0000_0000_C000_000000000046_0_8_4.py please help
panda001
1

votes
0

answer
410

Views

How to get timezone from lat long or zip code where tzwhere is not a option

As tzwhere is taking a longer time to run on Serverless, how do I get the proper timezone which supports daylight savings. I need to pass in either latitude and longitude or the zipcode to find the timezone, say, 'US/Eastern'.
ZZzzZZzz

View additional questions