Tagged Questions
0
votes
2answers
34 views
How should I go about assigning a binary dummy variable for a bunch of times?
I have two spreadsheets. One of them is about 20000 rows of patients entering an emergency room. Each row has a date/time column, along with separate date and separate time columns. Clearly ...
0
votes
0answers
13 views
Changing Absolute paths for linked files in Adobe InDesign--Run a script? [on hold]
I’ve recently been asked to solve a situation with our marketing department. They have a lot of Adobe documents (InDesign, etc) that link to images and other files outside of the project folder ...
0
votes
2answers
32 views
Matching word boundaries with python re
I'm having trouble using the \b metacharacter in python re's. I think I'm just reading the docs wrong because I often have the same problem in other languages.
Assume the following:
import re
...
130
votes
16answers
131k views
In Python, how do I get the path and name of the file that is currently executing?
I have scripts calling other script files but I need to get the filepath of the file that is currently running within the process.
For example, let's say I have three files. Using execfile, ...
-2
votes
1answer
23 views
How to install python 2.7 through CMD [closed]
How to install python through command line? Can i create a batch file and run it? I tried searching over the internet but with no help.
0
votes
0answers
12 views
Translating Python to MEL, create curve on transform positions
This is my Python code. Very basic, it takes the transforms and passes the position to curve positions.
How do I write that in MEL? I don't suppose I can drop lists of position in an overall list in ...
-2
votes
2answers
38 views
scripting tool to modify configuration files
we are modifying the expected format for some configuration files and I want to create a script to convert files of the old format to the new one. However, my scripting skills are rusty, I have to ...
-2
votes
0answers
26 views
Where can I use installed Python Packages
I'm currently using PowerShell to learn aspects of Python and have installed pip, nose and distribute, after some playing around I realised I could only use pip to install packages directly from ...
55
votes
6answers
10k views
Why the Global Interpreter Lock?
What is exactly the function of Python's Global Interpreter Lock?
Do other languages that are compiled to bytecode employ a similar mechanism?
-1
votes
1answer
24 views
Is there a new/updated Twill?
I've been trying to learn Twill Scripting on Python and I am using Python 3.4 and Twill 1.8.0. Been reading some posts here and I found it interesting to study. But, I do have a problem installing ...
1
vote
5answers
3k views
Why does the Python/C API crash on PyRun_SimpleFile?
I've been experimenting with embedding different scripting languages in a C++ application, currently I'm trying Stackless Python 3.1. I've tried several tutorials and examples, what few I can find, to ...
0
votes
1answer
30 views
Need for Performance in bash script
I have 50000 files and each one has 10000 lines. Each line is in the form:
value_1 (TAB) value_2 (TAB) ... value_n
I wanted to remove specific values from every line in every file (i used cut to ...
0
votes
2answers
35 views
Python - Change the textField after browsing - MAYA
I've got the most annoying problem with my GUI Exporter in Maya. I've made the textField etc. work, but I can't change the value of the textField after it's created, which is what I need to do.
What ...
1
vote
1answer
37 views
Issues getting python 3 linux created script to run on Windows python 3
If anyone can help me, that would be great. I created a python server and client script on Linux with python version 2.6. To my understanding as long as I install the same version of python in ...
0
votes
2answers
35 views
Counting the number of character differences between two files
I have two somewhat large (~20 MB) txt files which are essentially just long strings of integers (only either 0,1,2). I would like to write a python script which iterates through the files and ...
-1
votes
0answers
18 views
Python Script in an Android App [duplicate]
I have written an android app that needs some file format conversion using python. Currently i am able to run python on android using QPython console.
But i need some help:
Is it possible to run a ...
-2
votes
1answer
50 views
Is Django what I am looking for? [closed]
I am a SDET for a company where my primary task is to automate test and validate data. Without boring, ill get to the point.
I have been appointed to write Python scripts that validate data that ...
-1
votes
1answer
27 views
Script for gzip-inflate of HTTP messages in file
One of the tools I'm using saves the HTTP data into log files per connection. I was wondering if there is some kind of script to inflate gzip compressed messages in the file.
The data looks like ...
-5
votes
1answer
39 views
Documentation for understanfing [closed]
I found this answer to a question I originally had and the answer is excellent can someone add documentation to the script so I can better understand each part of it and the variables or specific ...
0
votes
2answers
47 views
Increment all numbers in a file
I have a file which looks like:
(890 1782 0)
(8 9 56)(5 28 987)
And I want to increment every number by one:
(891 1783 1)
(9 10 57)(6 29 988)
I am sure there must be a simple way of doing this, ...
0
votes
1answer
48 views
I need to run a bash command if output has characters and other command if output is empty
I have a mount script and I need to run a command when Python command output has characters in it and if the output is empty then run something else.
Example:
## define a function that launched the ...
2
votes
3answers
361 views
Using Python to match split-RAR extensions
I'm using a Python script in EventGhost to match certain file types in a directory and move them to certain places for other programs to perform actions on them. Here's the entire script:
import ...
-3
votes
1answer
38 views
Reading file from variable in Python [closed]
I am trying read the contents of file through a variable
file = '/home/ec2-user/abc.txt'
paths = open("file","r+")
print paths.read()
But this is not working. I need help; I don't want specify ...
3
votes
3answers
3k views
python chdir to dir the py script is in
How do i chdir to the directory that the python script is in? so far i figured out os.chdir and sys.argv[0]. I'm sure there is a better way then to write my own func to parse argv[0]
0
votes
3answers
34 views
checking/verifying python code
Python is a relatively new language for me and I already see some of the trouble areas of maintaining a scripting language based project. I am just wondering how the larger community , with a scenario ...
1
vote
1answer
57 views
Safe Python expression evaluation
I'm writing a totally non-blender related python script, and I noticed Blender has implemented a solution to a problem I was having.
I'm trying to input a python expression to the program, ...
0
votes
1answer
31 views
i need to write a script for telnet automation .. so i wrote a program but i am unable to change the directory using telnet
according to my code ( it takes host from command line argument)
#!usr/bin/python
import sys
import telnetlib
import subprocess
import os
import commands
user = "test"
...
1
vote
3answers
3k views
Python: checking if point is inside a polygon
I have a class describing a Point (has 2 coordinates x and y) and a class describing a Polygon which has a list of Points which correspond to corners (self.corners)
I need to check if a Point is in a ...
1
vote
2answers
317 views
Running a Python Script on a server (Does it have to be in /cgi-bin/)?
Right now I have a script thats
http://www.example.com/cgi-bin/foo?var1=A&var2=B
Is there a way that I can have it run outside of the cgi-bin directory? Like could I have
...
1
vote
1answer
43 views
Use Powershell to retrieve number from a sequence using web request
I have a very specific problem I have been trying to work out. I'm using a PowerShell script to name newly imaged computers during the imaging proceess, and I need to grab a newly generated number ...
1
vote
2answers
27 views
Python interpreter's relationship with scripts
In my current directory, I have a foo1.py script and a directory named other with a foo2.py script inside.
Now:
I launch the interpreter, and using execfile I can launch both scripts. The thing is, ...
2
votes
0answers
25 views
Pros and cons of 'script' vs. 'entry_point' in Python command line scripts
Python's setuptool has two ways of adding command line scripts to a Python package: script and entry_point.
This tutorial outlines these ways:
scripts
Add a Python script (funniest-joke) to the ...
1
vote
1answer
1k views
Execute multiple .py files at the same time
I have three .py files that I want to run at the same time in a Python script file. I initially called subprocess.call() three times (once for each .py file) but remembered that it blocks until the ...
1
vote
1answer
29 views
Python Scripting Question
I have a question about writing a small tool that would provide the headers for any website. I am new to python but wanted to know if there is anything else other than encoding that I would have to ...
0
votes
0answers
29 views
renaming pdfs in python
Don't know much python, working on someones code who's since left the company. I have two text boxes that a user fills out, hits rename and it should rename the pdf files in the folder with the two ...
0
votes
1answer
38 views
python - parse text between two strings and write each match to separate files
I would like to parse block of text between two strings and send each match to separate file.
For example:
I want parse each block of text between "start" and "end" strings and send each match into ...
-2
votes
3answers
81 views
file and string manipulation in TCL (or python)
what I want to do is :
I have a file( let's call it a.txt) with variables:
name.gender.age
and I want to extract the name and based on gender and age add a certain text and save everything in another ...
0
votes
2answers
31 views
Writing and documenting a Python script with variable number of arguments
I am new to Python and I would like to run a script by passing a variable number of arguments. That is, from my terminal window I would like to run the same command as-like the followings:
// Case1
...
0
votes
1answer
28 views
Duplicates in a string in Python
I realize this question has been asked an infinite number of number of times, but I have spin on it. I am attempting to check a list of elements for duplicates and print either of two responses ...
-1
votes
1answer
30 views
Making xml query in Python script
module_rm = "resource-mgr"
def get_data_name(self, path):
dataClass = "logicalRouterInterface"
dataProp = "dn"
msg = """<?xml version=\"1.0\" encoding=\"UTF-8\"?>
...
0
votes
1answer
44 views
Python script setting breakpoints and the encounter of a comment
I am trying to build a script that sets breakpoints in winidea (this ide will run a prjoect, that has different comments) . The breakpoints must be set in winidea after a specific comment was ...
2
votes
4answers
3k views
Exit to command line in Python
I have a script that I want to exit early under some condition:
if not "id" in dir():
print "id not set, cannot continue"
# exit here!
# otherwise continue with the rest of the script...
...
0
votes
0answers
32 views
arcpy.env module being interpreted as 'str' object?
Basically, I have a small script that executes some geoprocessing tasks and saves the work in a user specified directory. It has been running fine for months, when all of a sudden i start seeing this ...
-1
votes
2answers
339 views
Python in Nuke: except StopIteration
Basically what I'm trying to do currently is set up a script in Nuke using python that takes nodes selected by the user and adds shuffle nodes to them for an easy compositing workflow. However I'm ...
-3
votes
1answer
55 views
(Solved) Bulk renaming .jpg files from “Firstname Lastname”.JPG to “username.jpg” script
I've been trying to google and search for my answer, but most solutions has a pre-determed algorithm to change the filenames. My script has to be kind of dynamic, and I'm not too good at Powershell ...
0
votes
2answers
95 views
Automating requests on a website
I basically need to send testimonial requests to all my friends in class on this site. This is what the page looks like(after logging in):
I need to enter the roll number in the textbox one by one ...
1
vote
2answers
1k views
Getting pid of the program just started in Python
So I need to create startup and stop scripts for a python program. I don't have much experience with writing script files so please bare with me. So far my temporary solution was to have the ...
-3
votes
1answer
68 views
Is there anything that I can do with Perl/Python but C# would not do? [closed]
I have done some development in C# and I love the language and the environment. I am taking a Perl class, and yes it sounds like easy learning curve, but there are some questions which I think need to ...
0
votes
1answer
31 views
Start and stop multiple processes at once (Ubuntu)
so I have a bunch of mixed scripts on my Ubuntu server which I would like to run all at once, keep the PID so i can kill them all at once. They are mixed ruby and python scripts, which shouldn't ...
1
vote
1answer
61 views
Concatenation of 3 columns (total number of possible combinations) using DataNitro
I am new to DataNitro and I am also a Python beginner, and currently exploring the endless possibilities of Excel spreadsheet programming using DataNitro.
I would like to concatenate 3 different ...