Interesting Tags
   11 tags on

1 answer

How to rewrite a text file in Python

So if I have a code like this: f = open('score.txt','r+') playersScore = 1 oldscore = (f.read()) oldscore = int(oldscore) score = oldscore + PlayersScore f.write(str(score)) f.close() The text file ...

1 answers | 11 secs ago by Anuj Choudhry on Stack Overflow stackoverflow.com
3 answers

Create new file if one exists, PYTHON

How do I increment files to add one if the previous is already exists? For example: 01.py exists so it creates 02.py and so on and so forth. Is there a way to do this without a ton of if statements? ...

0 answers

Linker errors with libmsodbcsql-13.0.so.0.0 preventing pyODBC to MS SQL connection. CentOS 7

I am trying to connect from a python app with pyodbc to a MS SQL server. I have pyodbc and unixODBC installed and I tried to install the MS driver for linux. I think the issue is that the MS driver ...

1 answer

Issues with JSON Data in Python

I am working on a project to incorporate Verizon Thingspace REST APIs into a Python program. A co-worker provided me with an example in CURL that works (I am not familiar with Curl so am trying to ...

1 answers | 3 mins ago by Andrew H on Stack Overflow stackoverflow.com
1 answer

Saving an Image file using binary Files - pyspark

Hell All, How can I save Image file(JPG format) into my local system. I used BinaryFiles to load the pictures into spark, converted them into Array and processed them. Below is the code from PIL ...

0 answers

SQLAlchemy AttributeError: 'EagerLazyOption' object has no attribute 'joinedload'

I cannot use chained joinedload on sqlalchemy options. Flask code is as follow inspection_list = db.session.query(Inspection).\ options( joinedload(Inspection.room). ...

2 answers

Join last element in list

I've been searching google and this site for an answer to this to no avail, with a few different search terms. So if the question has already been answered, I'd love to be pointed to it. I'm trying ...

2 answers | 5 mins ago by aryst0krat on Stack Overflow stackoverflow.com
1 answer

This bisection method doesn't return a result

I am trying to find the root of a graph using the bisection method, but I can not get Spyder to return values. I am a complete newbie so its possible that I have made an easy mistake but I can not ...

1 answers | 6 mins ago by Mark Kelly on Stack Overflow stackoverflow.com
2 answers

Modify pandas dataframe in python based on multiple rows

I am working with a DataFrame in Pandas / Python, each row has an ID (that is not unique), I would like to modify the dataframe to add a column with the secondname for each row that has multiple ...

2 answers | 7 mins ago by LJH11 on Stack Overflow stackoverflow.com
0 answers

openpyxl showing '=' instead of formula

I'm using openpyxl to read an Excel spreadsheet with a lot of formulas. For some cells, if I access the cell's value as e.g. sheet['M30'].value I get the formula as intended, like ...

0 answers

OpenPyxl - difficulty getting cell value when cell is referencing other source

I have a spreadsheet which references/caches values from an external spreadsheet. When viewing the cell in Excel that I want to read using OpenPyxl, I see the the contents as a string: Users . When ...

0 answers

Saving an image in MYSQL vs saving to a folder

Is there an advantage to either method and/or a risk to either? Looking to upload JPG or PNG files only with a size limit of ~3mb with reduction done before insertion.

2 answers

Django “Dependency on unknown app” error even though the app folder exists

I'm trying to run manage.py runserver or manage.py makemigrations, but I'm getting an error when I do. The error is: ValueError: Dependency on unknown app: backend. Here's the full error message: ...

2 answers | 18 mins ago by bhsu on Stack Overflow stackoverflow.com
0 answers

Python Arabic Wordnet Synonym loop iteration error?

I am using arabic wordnet to find synonyms it works fine using the code below and it output the correct synonym: import unicodedata from nltk.corpus import wordnet as wn yxz='work' jan = ...

0 answers

How to create common colorbar, common labels and title in matplolib

Hey there I am trying to create a figure with 4 subplots sharing the axes. I was trying for hours to get a common horizontal colorbar along the x axis. A minimal example of my code is: import ...

0 answers

How to deploy Python Flask app to Apache running on Amazon Linux EC2 instance

I'm really struggling here. I have a simple Python Flask REST API that I've developed. The API runs fine in my local development environment (Mac OS X) and when directly executed via the console on my ...

0 answers

Django CSRF Protection Fails During Testing

I'm having issues testing template loading in a django project. I want to use the views included in the django.contrib.auth but use my own login templates. The tests fail and indicate that they are ...

0 answers

Install Python 3.5 with pip on Debian 8

so, my question is very simple, how can I install Python 3.5 with pip on Debian 8, without getting errors like ImportError: cannot import name 'HTTPSHandler'?

3 answers

Error when using scrapy for Python

I have been trying to run scrapy to scrape websites and everytime I try to run one I run into some issues. When I run on the command line scrapy crawl [FILE] I get back a bunch of errors that ...

1 answer

Custom validation of a user's e-mail for Django ModelChoiceField

In my models I have setup a custom model (CodeUser) with a foreign key to the User model of django.contrib.auth. I am actually using django-auth-ldap, but the User model is the same. I then have a ...

1 answer

.gt operator in Pandas DataFrame

I have a master_reference object that corresponds to a file in a Pandas data frame with four columns of metrics. d = {'one' : pd.Series([1000., 1001., 2000., 3000.], index=['A', 'B', 'C', 'D']), ...

1 answers | 25 mins ago by tdunham28 on Stack Overflow stackoverflow.com
1 answer

Element not visible error (Python, Selenium)

I'm having an issue where an error appears in my PYTHON GUI stating 'ElementNotVisibleException: Message: Element is not currently visible and so may not be interacted with', so it's stopping my ...

0 answers

Gui in python - guidance

i am trying to create a gui in python as simple as possible. I have a main screen with 8 buttons. i have designed the whole screen once and i designed another image to load for every button pressed. ...

3 answers

Error while traversing binary search tree - Python

I'm trying to run the classic algorithms for tree traversing. I've created an example tree and tested whether the preorder, inorder and postorder algorithms worked correctly. But after that tests I ...

1 answer

How to calculate time until certain clock? python

I need to create a basic program, where the user is asked to type in, what time does his/her bus leave and then the program tells him/her, how much time is left. The problem is I can't get the program ...

1 answers | 28 mins ago by thomk7 on Stack Overflow stackoverflow.com
0 answers

path to /opt/python3.5.0/bin for the usage of python3

I installed python3.5.0 in /opt/python3.5.0/bin/, but I couldn't use it beyond this bin folder. I know this is a path issue. Could somebody point out the correct procedure to make python3 show up in ...

2 answers

Wrong version of pydot is being imported

I installed pydot2 successfully using the Ipython notebook. %%bash pip install pydot2 Collecting pydot2 Downloading pydot2-1.0.33.tar.gz Requirement already satisfied (use --upgrade to upgrade): ...

2 answers | 34 mins ago by Ram Srinivasan on Stack Overflow stackoverflow.com
1 answer

pip will not install mysql-pthon

When running $ pip install mysql-python I'm getting the following error > _mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory > error: ...

1 answers | 42 mins ago by HenryM on Stack Overflow stackoverflow.com
2 answers

How to compare if two contour paths are visually similar - Python / Matplotlib

I wondering how to compare if two paths of a contour overlap, if they are similar. To be more specific, I have a set of n realizations, each one with its contour levels. I need to verify the ...

1 answer

How to install epel-release in Unix

I'm trying to configure Unix to access Twitter with Python and our instructor told us to use $ brew install epel-release $ brew install python-devel $ brew install python-pip among other packages, ...

15 30 50 per page
1 2 3