export

UnicodeDecodeError for a Python script to extract URLs from a batch of JSON files

UnicodeDecodeError for a Python script to extract URLs from a batch of JSON files Question: I’m trying to make a script for extracting URLs from a batch of JSON files but I’m getting this error I can’t figure out how to resolve: UnicodeDecodeError: ‘charmap’ codec can’t decode byte 0x98 in position 7837: character maps to …

Total answers: 1

Python Sqlite and Excel output with headers and Row ID

Python Sqlite and Excel output with headers and Row ID Question: Please help to find correct solution from "simple to customize in future" point of view. I have SQLite table and very big select. After this select I got 5 column and any rows. I want to export this data to Special Excel file and …

Total answers: 1

How to access data from custom_export in Otree?

How to access data from custom_export in Otree? Question: I am trying to use ExtraModel and custom_export to export data from live_pages. However, when I go on devserver and check the data tab, it is nowhere to be found. If I download the excel (bottom right of the page) the new variables are not included …

Total answers: 1

how to write output of one module in another module as csv file

how to write output of one module in another module as csv file Question: I am trying to write output of one module in a output file of another module. For example, first module : def sentence_token(): # some code sentences = sentence_tokenizer(tokens) count_sentence = f"total count of sentence is {len(sentences)}" second module : def …

Total answers: 1

How to save a matplotlib.pause animation to video?

How to save a matplotlib.pause animation to video? Question: I have an animation created with plt.pause as below… import matplotlib.pyplot as plt for i in range(10): plt.scatter(0, i) plt.pause(0.01) plt.show() How can I save this as a video file, e.g. a .mp4 file? Asked By: SamTheProgrammer || Source Answers: First, I have to redefine the …

Total answers: 1

python pptx export img (png, jpeg)

python pptx export img (png, jpeg) Question: I have developed a small code in Python in order to generate PPTX. But I would like also to generate a picture in png or jpeg of this slide. from pptx import Presentation from pptx.util import Inches img_path = ‘monty-truth.png’ prs = Presentation() blank_slide_layout …

Total answers: 3

Print chosen worksheets in excel files to pdf in python

Print chosen worksheets in excel files to pdf in python Question: I need to write a python script to read excel files, find each worksheet and then print these to pdf with the standard formating defined in the excel. I found the following question How can I open an Excel file in Python? which pointed …

Total answers: 2

set environment variable in python script

set environment variable in python script Question: I have a bash script that sets an environment variable an runs a command LD_LIBRARY_PATH=my_path sqsub -np $1 /homedir/anotherdir/executable Now I want to use python instead of bash, because I want to compute some of the arguments that I am passing to the command. I have tried putenv(“LD_LIBRARY_PATH”, …

Total answers: 3

How to use export with Python on Linux

How to use export with Python on Linux Question: I need to make an export like this in Python : # export MY_DATA=”my_export” I’ve tried to do : # -*- python-mode -*- # -*- coding: utf-8 -*- import os os.system(‘export MY_DATA=”my_export”‘) But when I list export, “MY_DATA” not appear : # export How I can …

Total answers: 12