Title
stringlengths 15
150
| A_Id
int64 2.98k
72.4M
| Users Score
int64 -17
470
| Q_Score
int64 0
5.69k
| ViewCount
int64 18
4.06M
| Database and SQL
int64 0
1
| Tags
stringlengths 6
105
| Answer
stringlengths 11
6.38k
| GUI and Desktop Applications
int64 0
1
| System Administration and DevOps
int64 1
1
| Networking and APIs
int64 0
1
| Other
int64 0
1
| CreationDate
stringlengths 23
23
| AnswerCount
int64 1
64
| Score
float64 -1
1.2
| is_accepted
bool 2
classes | Q_Id
int64 1.85k
44.1M
| Python Basics and Environment
int64 0
1
| Data Science and Machine Learning
int64 0
1
| Web Development
int64 0
1
| Available Count
int64 1
17
| Question
stringlengths 41
29k
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Can API hooking in python be OS agnostic?
| 11,639,758
| 2
| 6
| 6,564
| 0
|
python,python-3.x
|
In Python things like this is generally so trivial that it's hard to even provide examples. Hooks are generally callbacks, yes. Callbacks in python are simply done by passing functions around and calling them.
| 0
| 1
| 0
| 0
|
2012-07-24T16:38:00.000
| 3
| 0.132549
| false
| 11,635,443
| 1
| 0
| 0
| 1
|
In the world of penetration testing with Python, it looks like
one has to generally hook into an API that's OS specific. This makes sense
to me because we're dealing with different architectures and kernels between
OSX, Linux, Windows. But I'm wondering if this isn't the case?
Beyond some of the limited functionality you get out of the OS module, my assumption is that hooking into the OS's API is general going to be specific to *POSIX flavor (maybe they have more in common) than in Windows for example.
In particular I'm thinking of Deviare on Windows. It deals with .DLL files. That's pretty much Windows.
The moment we hear DLL, the mind goes to windows land, .plist OS X and so on.
|
Output of a process displayed in multiple consoles
| 11,663,302
| 0
| 0
| 234
| 0
|
python,linux,ssh,console
|
I have seen that indeed screen does what i need...
Thanks Ignacio
| 0
| 1
| 0
| 0
|
2012-07-25T07:35:00.000
| 2
| 1.2
| true
| 11,644,808
| 0
| 0
| 0
| 2
|
I have a python script that runs continuously in background and print some logs on standard output.
If I log with the same user on the same machine via ssh however I cannot see the output since (I guess) I opened a different shell.
Is there any way to specify that the standard output of this process must be seen by all the shell where I am logged with the same username of the one who launched the process?
Alternatively I thought of redirecting the output to a file and open this file… however I would prefer avoiding such a solution.
Thanks in advance for any suggestion…
|
Output of a process displayed in multiple consoles
| 11,645,207
| 0
| 0
| 234
| 0
|
python,linux,ssh,console
|
In UNIX you could write to all shells using the command wall. I'm not sure if there is a Python binding for wall though.
| 0
| 1
| 0
| 0
|
2012-07-25T07:35:00.000
| 2
| 0
| false
| 11,644,808
| 0
| 0
| 0
| 2
|
I have a python script that runs continuously in background and print some logs on standard output.
If I log with the same user on the same machine via ssh however I cannot see the output since (I guess) I opened a different shell.
Is there any way to specify that the standard output of this process must be seen by all the shell where I am logged with the same username of the one who launched the process?
Alternatively I thought of redirecting the output to a file and open this file… however I would prefer avoiding such a solution.
Thanks in advance for any suggestion…
|
Add logging to tests results in jenkins
| 11,650,753
| 1
| 2
| 3,561
| 0
|
python,jenkins,jython,nose
|
There is no way to achieve this from your tests. The report generator simply won't display the output unless there are errors.
You will have to get the sources for Jenkins itself (the JUnit runner is built into it) and patch the reporter or write your own plugin.
| 0
| 1
| 0
| 0
|
2012-07-25T09:35:00.000
| 2
| 0.099668
| false
| 11,646,830
| 0
| 0
| 1
| 2
|
I am using nose in jenkins to test a project. If a test fails, I get a short report of the output to the console. I would like to have this output regardless of the test result. So even if the test passes I want to be able to see the tests output to stderr/stdout.
At the moment I can turn off logging by calling nose with --nocapture. However this results in all the output beeing under the projects console log that jenkins creates by default. How I tell nose/capture to append the captured output to each test result shown in Jenkins?
I use xunit to generate a junit compatible xml file which is in turn used by Jenkins to generate its reports.
edit: Additional Infos as requested
Url in Jenkins (after buildnumber part):
/testReport/testDesignParser.testDesignCsvParser.testDesignCsvParser/testDesignCsvParser/test/?
I know that this design is not pretty but thats how it is now. If it matters:
`testDesignParser.testDesignCsvParser.testDesignCsvParser` module
`testDesignCsvParser` class
`test` (member)testfunction
|
Add logging to tests results in jenkins
| 11,742,115
| 2
| 2
| 3,561
| 0
|
python,jenkins,jython,nose
|
With the latest Jenkins there is an option to save the output (Retain long standard output/error) right under the post build step belonging to JUnit. Additionally I run nose with --nocapture. This gives me a console output view on every test (an option on the left menu when I have a test opened)
| 0
| 1
| 0
| 0
|
2012-07-25T09:35:00.000
| 2
| 1.2
| true
| 11,646,830
| 0
| 0
| 1
| 2
|
I am using nose in jenkins to test a project. If a test fails, I get a short report of the output to the console. I would like to have this output regardless of the test result. So even if the test passes I want to be able to see the tests output to stderr/stdout.
At the moment I can turn off logging by calling nose with --nocapture. However this results in all the output beeing under the projects console log that jenkins creates by default. How I tell nose/capture to append the captured output to each test result shown in Jenkins?
I use xunit to generate a junit compatible xml file which is in turn used by Jenkins to generate its reports.
edit: Additional Infos as requested
Url in Jenkins (after buildnumber part):
/testReport/testDesignParser.testDesignCsvParser.testDesignCsvParser/testDesignCsvParser/test/?
I know that this design is not pretty but thats how it is now. If it matters:
`testDesignParser.testDesignCsvParser.testDesignCsvParser` module
`testDesignCsvParser` class
`test` (member)testfunction
|
How do I debug a Python extension written in C?
| 11,648,687
| 1
| 1
| 262
| 0
|
python,debugging
|
You can compile a debug-enabled version python in your home folder without having root access and develop the C extension against that version.
| 0
| 1
| 0
| 1
|
2012-07-25T10:33:00.000
| 1
| 0.197375
| false
| 11,647,810
| 0
| 0
| 0
| 1
|
How do I debug a Python extension written in C? I found some links that said we need to get the Python debug built, but how do we do that if we don't have root access? I have Python 2.7 installed.
|
Why do up and down arrow commands not work in the Python command line interpreter?
| 11,656,437
| 7
| 10
| 6,773
| 0
|
python,linux,cpython
|
By default, the keymappings are:
older: alt-p
more recent: alt-n
You can change it in Options -> Configure IDLE -> Keys -> "history-previous" and "history-next" respectively.
| 0
| 1
| 0
| 0
|
2012-07-25T18:32:00.000
| 2
| 1
| false
| 11,656,306
| 1
| 0
| 0
| 1
|
I am using a VT100 terminal emulator on Linux. In bash, up and down arrows scroll through the last commands executed; they work as expected.
Previous (up arrow) and next (down arrow) commands are not interpreted in the Python command line interpreter. What kind of key mappings do I need to make this work?
Thank you.
|
Aquamacs (on Mac lion): whatever I write i being interpreted as "Enter"
| 18,509,905
| 1
| 0
| 323
| 0
|
python,osx-lion,aquamacs
|
I also met with this problem recently.
You need to add minor mode Fill. Press on the Python in the mode line in mouse-3 way and choose Auto Fill.
| 0
| 1
| 0
| 0
|
2012-07-25T23:27:00.000
| 1
| 0.197375
| false
| 11,660,203
| 0
| 0
| 0
| 1
|
I am editing a python script that I wrote a while ago, using aquamacs on Mac lion.
Whichever letter or number I type is being interpreted as "enter" (that is, I hit "g" for example, my text is dissrupted and a newline appears, but "g" does not appear). Restarting aquamacs, the terminal out of which I run it, or the whole computer did not help.
Other observations (that might or might not be connected):
- The script is located in a folder under Dropbox
- The file has special attributes (that is an "@" appears at the end of the permissions, upon typing ls -lah)
- I might have hit a combination of Control, Apple and other keys that I should not have ....
Any solution to this would be very much appreciated (and my apologies, if that has been treated before).
Thanks!
|
How to start Python IDLE from python.exe window if possible, and if not, what is python.exe even used for?
| 11,661,081
| 0
| 0
| 2,121
| 0
|
python,python-idle
|
python.exe is Python, the python interpreter specifically.
| 0
| 1
| 0
| 0
|
2012-07-26T01:22:00.000
| 3
| 0
| false
| 11,661,053
| 1
| 0
| 0
| 1
|
I am running Windows 7 currently, and I remember when using Linux at the school computers I was able to type "gedit &" into the terminal for example to open up the gedit text editor. I was wondering whether there is a similar process to open IDLE, and for that matter a Python program/script by typing it into the "terminal-equivalent." I'm a complete newbie, so I may be off-base a bit...anyways, so there is this terminal-like program called python.exe, and it seems like it should be able to open Python-related software (like IDLE), and I was wondering 1) what python.exe is for, 2) whether it can be treated like a Linux terminal, and 3) how to do stuff in it. I've tried various commands and I get a syntax error for virtually everything. Much appreciated!
|
Is there any way to excute a command as a specific user in Python?
| 11,662,267
| 2
| 2
| 814
| 0
|
python,linux,shell,operating-system,command
|
All of the things you've mentioned (which have been succeeded by the subprocess module by the way) are ways of spawning processes. You sound like you're looking for setuid. You can either call a function that will do that (e.g. os.setuid), or, as often is the case depending on what your script does, you can just run the entire script as the elevated user.
| 0
| 1
| 0
| 0
|
2012-07-26T04:10:00.000
| 3
| 1.2
| true
| 11,662,219
| 0
| 0
| 0
| 1
|
As far as I kown, there are about 3 ways to excute a system command in Python:
os.system(command) -> exit_status
os.popen(command [, mode='r' [, bufsize]]) -> pipe
commands.getoutput(command)-> string
Now I need to control the excutor of a system command, beside the way like:
os.system('su xxx;' + command)
is there any other more elegant way to reach the same effect?
|
How to make Python script portable to machines with interpreters in different locations?
| 11,674,391
| 2
| 1
| 155
| 0
|
python
|
env is a program that handles these sort of things. You should pretty much always use something like #! /usr/bin/env python3 as your shebang line rather than specifying an absolute path.
| 0
| 1
| 0
| 1
|
2012-07-26T17:02:00.000
| 2
| 0.197375
| false
| 11,674,359
| 1
| 0
| 0
| 1
|
I'm sure this is well documented somewhere, but I can't find it! I want to make my scripts portable to machines that may not have their Python interpreters in the same location. For that reason, I thought that I could just code the first line as #!python3 rather than with the absolute path to the interpreter, like #!/usr/local/bin/python3.
No doubt most of you understand why this doesn't work, but I have no idea. Although my lab mates aren't complaining about having to recode my scripts to reflect the absolute path to the interpreter on their own machines, this seems like it shouldn't be necessary. I'd be perfectly happy with a response providing a link to the appropriate documentation. Thanks in advance.
|
AppEngine datastore reserve ID range
| 11,681,451
| 1
| 0
| 178
| 0
|
python,google-app-engine,google-cloud-datastore
|
I found the answer: db.allocate_id_range(...)
| 0
| 1
| 0
| 0
|
2012-07-27T04:15:00.000
| 1
| 1.2
| true
| 11,681,354
| 0
| 0
| 1
| 1
|
Is it possible to tell AppEngine Datastore to reserve a range of IDs, which should never be allocated to models?
|
Python, UTF-8 filesystem, iso-8859-1 files
| 11,835,980
| 0
| 0
| 1,707
| 0
|
python,unicode,utf-8,filesystems,iso-8859-1
|
Use character encoding detection, chardet modules for python work well for determining actual encoding with some confidence. "as appropriate" -- You either know the encoding or you have to guess at it. If with chardet you guess wrong, at least you tried.
| 0
| 1
| 0
| 0
|
2012-07-27T13:53:00.000
| 2
| 0
| false
| 11,689,223
| 1
| 0
| 0
| 1
|
I have an application written in Python 2.7 that reads user's file from the hard-drive using os.walk.
The application requires a UTF-8 system locale (we check the env variables before it starts) because we handle files with Unicode characters (audio files with the artist name in it for example), and want to make sure we can save these files with the correct file name to the filesystem.
Some of our users have UTF-8 locales (therefore a UTF-8 fs), but still somehow manage to have ISO-8859-1 files stored on their drive. This causes problems when our code tries to os.walk() these directories as Python throws an exception when trying to decode this sequence of ISO-8859-1 bytes using UTF-8.
So my question is, how do I get python to ignore this file and move on to the next one instead of aborting the entire os.walk(). Should I just roll my own os.walk() function?
Edit: Until now we've been telling our users to use the convmv linux command to correct their filenames, however many users have various different types of encodings (8859-1, 8859-2, etc.), and using convmv requires the user to make an educated guess on what files have what encoding before they run convmv on each one individually.
|
Error when installing pyodbc on opensuse
| 11,691,895
| 2
| 1
| 4,644
| 1
|
python,pyodbc,opensuse
|
I don't see a way around having the Python header files (which are part of python-devel package). They are required to compile the package.
Maybe there was a pre-compiled egg for the 64bit version somewhere, and this is how it got installed.
Why are you reluctant to install python-devel?
| 0
| 1
| 0
| 0
|
2012-07-27T15:32:00.000
| 2
| 1.2
| true
| 11,691,039
| 0
| 0
| 0
| 1
|
when I try to install the pyodbc by using "python setup.py build install", it shows up with some errors like the following:
gcc -pthread -fno-strict-aliasing -DNDEBUG -march=i586 -mtune=i686 -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -fwrapv -fPIC -DPYODBC_VERSION=3.0.3 -I/usr/include/python2.6 -c /root/Desktop/pyodbc-3.0.3/src/sqlwchar.cpp -o build/temp.linux-i686-2.6/root/Desktop/pyodbc-3.0.3/src/sqlwchar.o -Wno-write-strings
In file included from /root/Desktop/pyodbc-3.0.3/src/sqlwchar.cpp:2:
/root/Desktop/pyodbc-3.0.3/src/pyodbc.h:41:20: error: Python.h: No such file or directory
/root/Desktop/pyodbc-3.0.3/src/pyodbc.h:42:25: error: floatobject.h: No such file or directory
/root/Desktop/pyodbc-3.0.3/src/pyodbc.h:43:24: error: longobject.h: No such file or directory
/root/Desktop/pyodbc-3.0.3/src/pyodbc.h:44:24: error: boolobject.h: No such file or directory
and few more lines with similar feedback, in the end of the reply is like:
/root/Desktop/pyodbc-3.0.3/src/pyodbccompat.h:106: error: expected ‘,’ or ‘;’ before ‘{’ token
error: command 'gcc' failed with exit status 1
and I have searched around for the solutions, everyone says to install python-devel and it will be fine, but I got this working on a 64bit opensuse without the python-devel,but it doesn't work on the 32bit one, and I couldn't found the right version for python2.6.0-8.12.2 anywhere on the internet... so I'm quite confused, please help! thanks in advance.
|
Creating a Scheduled task in Tkinter on Unix
| 11,691,425
| 1
| 2
| 355
| 0
|
python,unix,cron,tkinter,crontab
|
In most modern Linux distros like Debian or Ubuntu, you can add an executable file (like a shell script or a symlink to one) into /etc/cron.weekly and it will be automatically run once a week for you. This is using the anacron command, which is fairly common these days.
| 0
| 1
| 0
| 0
|
2012-07-27T15:51:00.000
| 1
| 0.197375
| false
| 11,691,351
| 0
| 0
| 0
| 1
|
Through an application I have made with Tkinter, I'm trying to add a command to run a script every week. When the program is closed the command should be in forever place.
I've sifted through the documentation on cron, but there doesn't seem to be a way to edit the crontab without using the shell. Also I've looked through the 'at' command, but that only seems to run once.
My question is - How can one create a weekly recurring task by issuing a single command in Python on Unix?
If not with only 1 command, can I use multiple?
|
How to continue the python script execution from the point it left before reboot
| 11,700,297
| 3
| 0
| 1,400
| 0
|
python,reboot
|
It's not about python but rather about your whole system config. In given conditions I suggest you to split your script on 2 parts. First part is doing 1..3 and storing some extra info you're required onto persistent storage other than the fs you're experimenting on. The second part is invoked on each OS os start, reads some data stored by first part and then performs checking actions 4..5. It seems to be the most obvious and simple way.
| 0
| 1
| 0
| 1
|
2012-07-28T10:24:00.000
| 1
| 0.53705
| false
| 11,700,172
| 0
| 0
| 0
| 1
|
I want to write a test script in python which should reboot the system in between the test execution on local machine... (No remote automation server is monitoring the script). How the script execution can be made continuous even after reboot? The script covers following scenario...
Create a Volume on some disk
Create a filesystem and mount the file system temporary
Reboot the system
Verify if filesystem is mounted
Mount the filesystem again.
|
How to run a python script inside the cgi-bin of apache server?
| 14,268,807
| 1
| 2
| 2,241
| 0
|
python,apache
|
BlaXpirit's answer should solve your problem with a 500 server internal error.
It is important to note the "\n" at the end of the first print statement. You can also write it as
print("Content-Type: text/html; charset=utf-8")
print()
I was surprised to learn that writing out these headers is necessary even if your Python program is only going to do server-side work - with no response to the browser at all.
| 0
| 1
| 0
| 1
|
2012-07-29T16:51:00.000
| 2
| 0.099668
| false
| 11,711,060
| 0
| 0
| 0
| 1
|
I put a simple python script inside the cgi-bin in apache2 and tried to execute it using the browser as follows,
"http://www.example.com/cgi-bin/test.py"
But it gives a 500 Internal sever error.
Following is the error.log in apache2.
[Sun Jul 29 22:07:51 2012] [error] (8)Exec format error: exec of '/usr/lib/cgi-bin/test.py' failed
[Sun Jul 29 22:07:51 2012] [error] [client ::1] Premature end of script headers: test.py
[Sun Jul 29 22:07:51 2012] [error] [client ::1] File does not exist: /var/www/favicon.ico
can anyone help me on this?
|
Problems starting created virtualenv instance
| 11,713,237
| 11
| 2
| 9,585
| 0
|
python,virtualenv
|
You don't run activate as a script; you need to source it in your shell, since it affects the shell itself.
It probably also doesn't make any sense to run it under sudo.
| 0
| 1
| 0
| 0
|
2012-07-29T21:40:00.000
| 2
| 1.2
| true
| 11,713,187
| 1
| 0
| 0
| 1
|
I'm trying to use virtualenv on my development machine. I successfully created my new environment issuing virtualenv venv in /home/user/. When I try to activate it (from user location) with sudo venv/bin/activate I get venv/bin/activate: command not found.
|
Python: Securing untrusted scripts/subprocess with chroot and chjail?
| 11,725,863
| 3
| 12
| 7,078
| 0
|
python,security,subprocess,chroot,jail
|
After creating your jail you would call os.chroot from your Python source to go into it. But even then, any shared libraries or module files already opened by the interpreter would still be open, and I have no idea what the consequences of closing those files via os.close would be; I've never tried it.
Even if this works, setting up chroot is a big deal so be sure the benefit is worth the price. In the worst case you would have to ensure that the entire Python runtime with all modules you intend to use, as well as all dependent programs and shared libraries and other files from /bin, /lib etc. are available within each jailed filesystem. And of course, doing this won't protect other types of resources, i.e. network destinations, database.
An alternative could be to read in the untrusted code as a string and then exec code in mynamespace where mynamespace is a dictionary defining only the symbols you want to expose to the untrusted code. This would be sort of a "jail" within the Python VM. You might have to parse the source first looking for things like import statements, unless replacing the built-in __import__ function would intercept that (I'm unsure).
| 0
| 1
| 0
| 0
|
2012-07-30T15:09:00.000
| 2
| 1.2
| true
| 11,724,257
| 0
| 0
| 0
| 1
|
I'm writing a web server based on Python which should be able to execute "plugins" so that functionality can be easily extended.
For this I considered the approach to have a number of folders (one for each plugin) and a number of shell/python scripts in there named after predefined names for different events that can occur.
One example is to have an on_pdf_uploaded.py file which is executed when a PDF is uploaded to the server. To do this I would use Python's subprocess tools.
For convenience and security, this would allow me to use Unix environment variables to provide further information and set the working directory (cwd) of the process so that it can access the right files without having to find their location.
Since the plugin code is coming from an untrusted source, I want to make it as secure as possible. My idea was to execute the code in a subprocess, but put it into a chroot jail with a different user, so that it can't access any other resources on the server.
Unfortunately I couldn't find anything about this, and I wouldn't want to rely on the untrusted script to put itself into a jail.
Furthermore, I can't put the main/calling process into a chroot jail either, since plugin code might be executed in multiple processes at the same time while the server is answering other requests.
So here's the question: How can I execute subprocesses/scripts in a chroot jail with minimum privileges to protect the rest of the server from being damaged by faulty, untrusted code?
Thank you!
|
Dpkg Python module?
| 11,727,678
| 0
| 9
| 6,866
| 0
|
python,linux,apt,deb,dpkg
|
I have little familiarity with python modules for debs, but I wanted to point out that calling subprocesses isn't the bad thing on *ix, that it is on Windows. Windows almost seems intended to break calling things as a subprocess and parsing output, but *ix usually makes it quite viable.
| 0
| 1
| 0
| 0
|
2012-07-30T18:02:00.000
| 4
| 0
| false
| 11,727,011
| 0
| 0
| 0
| 2
|
I'm trying to do some package manipulation (a la dpkg) and while I can just popen or subprocess.call I'd rather do things the python way if possible.
Unfortunately I've been unable to find a python module to do the trick.
I've seen reference to python-deb but it appears to be defunct. python-apt might seem like a potential solution, but AFAICT it cannot handle individual .deb files.
Anyone know of a good dpkg python solution?
|
Dpkg Python module?
| 11,728,384
| 0
| 9
| 6,866
| 0
|
python,linux,apt,deb,dpkg
|
Apparently Gdebi is python based. If gdebi installed you have access to it's functionality via the GDebi module.
I can't seem to find any documentation, so I'm not sure that it's meant to be a public API, but it might do the trick.
| 0
| 1
| 0
| 0
|
2012-07-30T18:02:00.000
| 4
| 0
| false
| 11,727,011
| 0
| 0
| 0
| 2
|
I'm trying to do some package manipulation (a la dpkg) and while I can just popen or subprocess.call I'd rather do things the python way if possible.
Unfortunately I've been unable to find a python module to do the trick.
I've seen reference to python-deb but it appears to be defunct. python-apt might seem like a potential solution, but AFAICT it cannot handle individual .deb files.
Anyone know of a good dpkg python solution?
|
Disable 'pause' in windows bat script
| 11,729,668
| 18
| 9
| 6,479
| 0
|
python,windows,batch-file,cmd
|
Try to execute cmd.exe /c YourCmdFile < nul
YourCmdFile - full path to your batch script
| 0
| 1
| 0
| 0
|
2012-07-30T21:04:00.000
| 4
| 1.2
| true
| 11,729,562
| 1
| 0
| 0
| 1
|
In windows, I am running a bat script that currently ends with a 'pause' and prompts for the user to 'Press any key to continue...'
I am unable to edit the file in this scenario and I need the script to terminate instead of hang waiting for input that will never come. Is there a way I can run this that will disable or circumvent the prompt?
I have tried piping in input and it does not seem to help. This script is being run from python via subprocess.Popen.
|
I need to run a python script from php
| 11,733,222
| 0
| 2
| 634
| 0
|
php,python,qiime
|
instead of system() try surrounding the code in `ticks`...
It has a similar functionality but behaves a little differently in the way it returns the output..
| 0
| 1
| 0
| 1
|
2012-07-31T04:33:00.000
| 3
| 0
| false
| 11,733,149
| 0
| 0
| 0
| 1
|
I have to design a interface using PHP for a software written in python. Currently this software is used from command line by passing input, mostly the input is a text file. There are series of steps and for every step a python script is called. Every step takes a text file as input and an generates an output text file in the folder decided by the user. I am using system() of php but I can't see the output but when I use the same command from command line it generates the output. Example of command :
python /software/qiime-1.4.0-release/bin/check_id_map.py -m /home/qiime/sample/Fasting_Map.txt -o /home/qiime/sample/mapping_output -v
|
How to clear output in Vte.Terminal?
| 11,804,847
| 0
| 1
| 303
| 0
|
python,gtk,pygtk,vte
|
I have been having some problems of my own with Vte so I don't know if I'm the right person to answer.
Have you tried replacing the old terminal with another in the container? It's not clearing, but there will be an empty terminal.
| 0
| 1
| 0
| 0
|
2012-07-31T05:02:00.000
| 4
| 0
| false
| 11,733,391
| 1
| 0
| 0
| 2
|
How to clear all output in Vte.Terminal ?
|
How to clear output in Vte.Terminal?
| 11,742,327
| 0
| 1
| 303
| 0
|
python,gtk,pygtk,vte
|
It would only clear the text visible in the terminal, but, you can run the cls command or tinker with the feed() method and empty spaces.
| 0
| 1
| 0
| 0
|
2012-07-31T05:02:00.000
| 4
| 0
| false
| 11,733,391
| 1
| 0
| 0
| 2
|
How to clear all output in Vte.Terminal ?
|
application run slowly under uwsgi threaded mode
| 11,733,510
| 0
| 1
| 947
| 0
|
python,memcached,uwsgi
|
You are probably experiencing the python GIL overhead. Try adding a second process to see if results are better.
| 0
| 1
| 0
| 0
|
2012-07-31T05:06:00.000
| 1
| 0
| false
| 11,733,437
| 0
| 0
| 1
| 1
|
we use uwsgi + nginx to build the web site. recently, we want to improve the qps of our site, so we decide to switch uwsgi mode from prefork to threaded. but we found something very bad.
when using prefork mode with workers setting 5, we get the request time is 10-20ms. but in threaded mode(one worker 5 threads), the value increase to 100-200ms. this is too bad.
we find memcache.Client take the most time which makes the request time increasing.
please help me to know where the problem is and how to solve, thank you!
PS:
code:
import memcache
client = memcache.Client(['127.0.0.1:11211'])
client.get('mykey')
|
Activated VENV still use system pip and system python? What's wrong?
| 11,735,136
| 0
| 6
| 2,687
| 0
|
python,virtualenv,pip
|
What shell are you using? What specific command did you use to activate the virtualenv?
In my case (also using squeeze) I am using bash and it if I run "source bin/activate" then everything in my path (pip, python, etc) is correct.
| 0
| 1
| 0
| 0
|
2012-07-31T07:19:00.000
| 2
| 0
| false
| 11,735,073
| 1
| 0
| 0
| 1
|
When I activate a venv, which pip returns /usr/local/bin/pip instead of path/to/my/apps/venv/bin/pop. Why is that?
I am inclined to just rm- rf the pip in /usr/local/bin/pip and install again, but since this is a production server I prefer not to guess too much :-)
My concern is that I have (in usr/local/bin):
easy_install
easy_install-2.6
pip
pip-2.6
virtualenv
virtualenv-2.6
python --version returns 2.6.6 and which python returns /usr/bin/python even though venvis activated?
Running Debian Squeeze
|
How to open a new console and run a python script
| 11,735,588
| 0
| 0
| 3,127
| 0
|
python,bash,sublimetext2
|
If you're using python 3.2 you can use the python debugger. At the beginning of your project, import pdb. Then at the point that you want to enter interactive mode, type pdb.set_trace(). (You have to put the trace one line above the last line, otherwise the program will finish and restart.) I don't know how to make it automatically enter interactive mode, but when the program gets to the trace the console will enter the debugger. You can then type interact, and press Enter, and you will be in interactive mode, with all your variables preserved.
| 0
| 1
| 0
| 0
|
2012-07-31T07:28:00.000
| 5
| 0
| false
| 11,735,203
| 1
| 0
| 0
| 1
|
Here is my problem: When running a python script from command line (bash), I'd like to open a new console window, run my python script and end up in the interactive python shell. Is there an easy way to do this?
Background: Right now, I am exploring sublime text 2 by developing a simple python script together with numpy. When I run build from within sublime, the script is executed but I do not have the possibility to further interact with the result.
|
Python: OAuth Library for Linux and Windows
| 11,759,545
| 2
| 2
| 736
| 0
|
python,oauth
|
All Python libraries that don't rely on native code or platform-specific APIs are portable. I don't see any of that in python-oauth or python-oauth2.
So your current library should work fine on Linux.
| 0
| 1
| 1
| 0
|
2012-08-01T12:33:00.000
| 2
| 1.2
| true
| 11,759,307
| 0
| 0
| 0
| 1
|
Is there a python library for oAuth which can be run on Window and Linux?
On window I am using python-oauth but I could not find an installation for Linux
|
Maintaining a (singleton) process with mod_wsgi?
| 11,768,941
| 0
| 1
| 396
| 0
|
python,apache,mod-wsgi,web.py
|
Easy. Don't restart Apache, don't set maximum-requests and don't change the code in the WSGI script file.
Are you saying that you are seeing restarts even when you leave Apache completely untouched?
And yes it sounds like you should be re-architecting your system. A web process that takes that long to startup is crazy.
| 0
| 1
| 0
| 0
|
2012-08-01T14:46:00.000
| 1
| 1.2
| true
| 11,761,785
| 0
| 0
| 1
| 1
|
I have a python web.py app with long (minutes) start-up time that I'd like to host with in Apache with mod_wsgi.
The long-term answer may be "rewrite the app." But in the short term I'd like to configure mod_wsgi to:
Use a single process to serve the app (I can do this with WSGIDaemonProcess processes=1),
and
Keep using that process without killing it off periodically
Is #2 doable? Or, are there other stopgap solutions I can use to host this app?
Thanks!
|
How to test if packet is sent correct?
| 11,763,064
| 0
| 0
| 1,276
| 0
|
c++,python,testing,networking
|
The only way to check if a packet has been sent correctly is by verifying it's integrity on the receiving end.
| 0
| 1
| 1
| 1
|
2012-08-01T15:40:00.000
| 3
| 0
| false
| 11,762,812
| 0
| 0
| 0
| 2
|
In my app i sent packet by raw socket to another computer than get packet back and write the return packet to another computer by raw socket.
My app is c++ application run on Ubuntu work with nfqueue.
I want to test sent packets for both computer1 and computer2 in order to check if they are as expected.
I need to write an automation test that check my program, this automation test need to listen to the eth load the sent packets and check if they are as expected (ip,ports, payload).
I am looking for a simple way (tool (with simple API), code) to do this.
I need a simple way to listen (automate) to the eth .
I preffer that the test will check the sender , but it might be difficult to find an api to listen the eth (i sent via raw socket) , so a suggested API that will check the receivers computers is also good.
The test application can be written in c++, java , python.
|
How to test if packet is sent correct?
| 11,809,920
| 0
| 0
| 1,276
| 0
|
c++,python,testing,networking
|
I operate tcpdump on the reciver coputer and save all packet to file.
I analysis the tcpdump with python and check that packet send as expected in the test.
| 0
| 1
| 1
| 1
|
2012-08-01T15:40:00.000
| 3
| 1.2
| true
| 11,762,812
| 0
| 0
| 0
| 2
|
In my app i sent packet by raw socket to another computer than get packet back and write the return packet to another computer by raw socket.
My app is c++ application run on Ubuntu work with nfqueue.
I want to test sent packets for both computer1 and computer2 in order to check if they are as expected.
I need to write an automation test that check my program, this automation test need to listen to the eth load the sent packets and check if they are as expected (ip,ports, payload).
I am looking for a simple way (tool (with simple API), code) to do this.
I need a simple way to listen (automate) to the eth .
I preffer that the test will check the sender , but it might be difficult to find an api to listen the eth (i sent via raw socket) , so a suggested API that will check the receivers computers is also good.
The test application can be written in c++, java , python.
|
Import data into Google App Engine in a way that is "easy" for the user of the application
| 11,780,827
| 1
| 1
| 181
| 0
|
python,google-app-engine,google-cloud-datastore,data-import
|
Have the user upload the file, then start a task that runs the import. Email results/errors to the user at the end. The other way I have done, is get the user to create the spreadsheet in google docs and have them supply the sheet key or link if it's published and then start a task that processes the spreadsheet directly from google docs.
| 0
| 1
| 0
| 0
|
2012-08-02T14:00:00.000
| 2
| 0.099668
| false
| 11,779,033
| 0
| 0
| 1
| 1
|
Building an application using Python in GAE that handles a lot of user data such as contacts, appointments, etc...
Would like to allow users to import their old data from other applications. For example an appointment might look like:
Start time Duration Service Customer Id
2012-08-02 09:50AM, 01:00:00, Hair cut, 94782910,
2012-08-02 10:50AM, 00:30:00, Dye job, 42548910,
...
I'm unfamiliar with accepted practices with handling this type of situation. I also see issues with handling this on google app engine specifically because requests can not take longer than 30 seconds.
Ideally, it seems like users should be able to upload CSV files of their data via a web page, but I don't really know of a good way to do this with app engine.
Another way I can think of would be to let users cut and paste text directly into and HTML text area. Then javascript could be used to iterate the data and POST it to the server one row at a time or in small chunks. This sounds really sketchy to me though.
Any ideas on what a "good" way to handle this would be?
Thanks so much!
|
django-admin.py: command not found
| 24,193,778
| 1
| 3
| 6,301
| 0
|
python,django,django-admin
|
i have the same Problem. the django-admin.py for me was in this Path ~/.local/bin.
this because i run pip instal --user django
| 0
| 1
| 0
| 0
|
2012-08-03T07:41:00.000
| 3
| 0.066568
| false
| 11,791,368
| 0
| 0
| 1
| 1
|
I have django-admin.py in usr/local/bin and I have tried all the help given on the web to make a symbolic link but it still says django-admin.py: command not found.
I am trying to start of my first project in django :- django-admin.py startproject mysite.
No matter what I do I just keep on getting django-admin.py: command not found.
I am using ubuntu 11.10.
Thanks
|
Print python script output correctly in PHP
| 11,792,313
| 0
| 3
| 10,514
| 0
|
php,python
|
An alternative would be wrapping the string between <pre>...</pre> tags.
| 0
| 1
| 0
| 1
|
2012-08-03T08:32:00.000
| 4
| 0
| false
| 11,792,129
| 0
| 0
| 0
| 1
|
i have a php file calls a script and prints the output like this
$output=shell_exec('/usr/bin/python hello.py');
echo $output;
it prints;
b'total 16\ndrwx---r-x 2 oae users 4096 Jul 31 14:21 .\ndrwxr-x--x+ 9 oae root 4096 Jul 26 13:59 ..\n-rwx---r-x 1 oae users 90 Aug 3 11:22 hello.py\n-rwx---r-x 1 oae users 225 Aug 3 11:22 index.php\n'
but it should be like this;
total 16K
drwx---r-x 2 oae users 4.0K Jul 31 14:21 ./
drwxr-x--x+ 9 oae root 4.0K Jul 26 13:59 ../
-rwx---r-x 1 oae users 90 Aug 3 11:22 hello.py*
-rwx---r-x 1 oae users 225 Aug 3 11:22 index.php*
\n characters shouldn't be shown.How can i solve this?
|
Using WebSphere MQ with Twisted
| 11,794,331
| 1
| 0
| 245
| 0
|
python,ibm-mq,twisted,pymqi
|
If you're going to use this functionality a lot, then having a native Twisted implementation is probably worth the effort. A wrapper based on deferToThread will be less work, but it will also be harder to test and debug, perform less well, and have problems on certain platforms where Python threads don't work extremely well (eg FreeBSD).
The approach to take for a native Twisted implementation is probably to implement a protocol that can speak to MQ servers and give it a rich API for interacting with channels, queues, queue managers, etc, and then build a layer on top of that which abstracts the actual network connection away from the application (as I believe mqi/pymqi largely do).
| 0
| 1
| 0
| 0
|
2012-08-03T08:58:00.000
| 1
| 1.2
| true
| 11,792,531
| 0
| 0
| 0
| 1
|
I'm trying to work out how to approach building a "machine" to send and receive messages to WebSphere MQ, via Twisted. I want it to be as generic as possible, so I can reuse it for many different situations that interface with MQ.
I've used Twisted before, but many years ago now and I'm trying to resurrect the knowledge I once had...
The specific problem I'm having is how to implement the MQ IO using Twisted. There's a pymqi Python library that interfaces with MQ, and it provides all the interfaces I need. The MQ calls I need to implement are:
initiate a connection to a specific MQ server/port/channel/queue-manager/queue combination
take content and post it as a message to the desired queue
poll a queue and return the content of the next message in the queue
send a request to a queue manager to find the number of messages currently in a queue
All of these involve blocking calls to MQ.
As I'm intending to reuse the Twisted/MQ interface many times across a range of projects, should I be looking to implement the MQ IO as a Twisted protocol, as a Twisted transport, or just call the pymqi methods via deferToThread() calls? I realise this is a very broad question with possibly no definitive answer; I'm really after advice from those who may have encountered similar challenges before (i.e. working with queueing interfaces that will always block) and found a way that works well.
|
I'm trying to use python in powershell
| 11,814,706
| 20
| 65
| 202,736
| 0
|
python,powershell,python-2.7
|
$env:path="$env:Path;C:\Python27" will only set it for the current session. Next time you open Powershell, you will have to do the same thing again.
The [Environment]::SetEnvironmentVariable() is the right way, and it would have set your PATH environment variable permanently. You just have to start Powershell again to see the effect in this case.
| 0
| 1
| 0
| 0
|
2012-08-05T02:05:00.000
| 13
| 1
| false
| 11,813,435
| 1
| 0
| 0
| 5
|
I'm trying to follow Zed Shaw's guide for Learning Python the Hard Way. I need to use python in Powershell. I have Python 2.7.3 installed in C:\Python27. Whenever I type python into Powershell, I get an error that says the term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program. I also typed in this: [Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27", "User")
That was a suggested solution provided, but typing python into Powershell still does nothing. I can type in "start python" and it opens up a window with python but I need it in Powershell. Thanks.
|
I'm trying to use python in powershell
| 33,180,819
| 11
| 65
| 202,736
| 0
|
python,powershell,python-2.7
|
The Directory is not set correctly so Please follow these steps.
"MyComputer">Right Click>Properties>"System Properties">"Advanced" tab
"Environment Variables">"Path">"Edit"
In the "Variable value" box, Make sure you see following:
;c:\python27\;c:\python27\scripts
Click "OK", Test this change by restarting your windows powershell. Type
python
Now python version 2 runs! yay!
| 0
| 1
| 0
| 0
|
2012-08-05T02:05:00.000
| 13
| 1
| false
| 11,813,435
| 1
| 0
| 0
| 5
|
I'm trying to follow Zed Shaw's guide for Learning Python the Hard Way. I need to use python in Powershell. I have Python 2.7.3 installed in C:\Python27. Whenever I type python into Powershell, I get an error that says the term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program. I also typed in this: [Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27", "User")
That was a suggested solution provided, but typing python into Powershell still does nothing. I can type in "start python" and it opens up a window with python but I need it in Powershell. Thanks.
|
I'm trying to use python in powershell
| 31,302,445
| 7
| 65
| 202,736
| 0
|
python,powershell,python-2.7
|
This works for me permanently:
[Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27","User")
| 0
| 1
| 0
| 0
|
2012-08-05T02:05:00.000
| 13
| 1
| false
| 11,813,435
| 1
| 0
| 0
| 5
|
I'm trying to follow Zed Shaw's guide for Learning Python the Hard Way. I need to use python in Powershell. I have Python 2.7.3 installed in C:\Python27. Whenever I type python into Powershell, I get an error that says the term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program. I also typed in this: [Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27", "User")
That was a suggested solution provided, but typing python into Powershell still does nothing. I can type in "start python" and it opens up a window with python but I need it in Powershell. Thanks.
|
I'm trying to use python in powershell
| 37,464,667
| 4
| 65
| 202,736
| 0
|
python,powershell,python-2.7
|
Sometimes you install Python on Windows and it doesn't configure the path correctly.
Make sure you enter [Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27", "User")
in PowerShell to configure it correctly.
You also have to either restart PowerShell or your whole computer to get it to really be fixed.
| 0
| 1
| 0
| 0
|
2012-08-05T02:05:00.000
| 13
| 0.061461
| false
| 11,813,435
| 1
| 0
| 0
| 5
|
I'm trying to follow Zed Shaw's guide for Learning Python the Hard Way. I need to use python in Powershell. I have Python 2.7.3 installed in C:\Python27. Whenever I type python into Powershell, I get an error that says the term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program. I also typed in this: [Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27", "User")
That was a suggested solution provided, but typing python into Powershell still does nothing. I can type in "start python" and it opens up a window with python but I need it in Powershell. Thanks.
|
I'm trying to use python in powershell
| 18,043,232
| 0
| 65
| 202,736
| 0
|
python,powershell,python-2.7
|
Just eliminate the word "User". It will work.
| 0
| 1
| 0
| 0
|
2012-08-05T02:05:00.000
| 13
| 0
| false
| 11,813,435
| 1
| 0
| 0
| 5
|
I'm trying to follow Zed Shaw's guide for Learning Python the Hard Way. I need to use python in Powershell. I have Python 2.7.3 installed in C:\Python27. Whenever I type python into Powershell, I get an error that says the term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program. I also typed in this: [Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27", "User")
That was a suggested solution provided, but typing python into Powershell still does nothing. I can type in "start python" and it opens up a window with python but I need it in Powershell. Thanks.
|
How to run a python script with Python Tools for Visual Studio in a virtualenv?
| 11,826,101
| 4
| 6
| 30,422
| 0
|
python,visual-studio-2010,ptvs
|
I found that if :
main.py is set as Startup File,
in the Properties of the project -> Debug tab -> Interpreter Path field, I put the path C:...\env\Scripts\python.exe (i.e. the python executable of the virtualenv)
It works !
| 0
| 1
| 0
| 0
|
2012-08-06T08:06:00.000
| 4
| 1.2
| true
| 11,824,589
| 1
| 0
| 0
| 1
|
I don't know how to run the activate.bat in a Python Tools for Visual Studio Project. I have a directory environment in my project with my virtualenv. But, I don't know how I can run ./env/Scripts/activate.bat before the project run my main python script.
|
Selectively indexing subdomains
| 11,829,421
| 1
| 0
| 134
| 0
|
python,seo,indexing,robots.txt,googlebot
|
No. The search engine should not care what script generates the pages. Just so long as the pages generated by the webapps are indexed you should be fine.
Second question:
You should create a separate robots.txt per subdomain. That is when robots.txt is fetched from a particular subdomain, return a robots.txt file that pertains to that sudomain only. So if you want the subdomain indexed, has that robots file allow all. If you don't want it indexed, have the robots file deny all.
| 0
| 1
| 0
| 1
|
2012-08-06T13:34:00.000
| 2
| 1.2
| true
| 11,829,360
| 0
| 0
| 1
| 1
|
I am working on Web application, which allows users to create their own webapp in turn. For each new webapp created by my application I Assign a new Subdomain.
e.g. subdomain1.xyzdomain.com, subdomain2.xyzdomain.com etc.
All these Webapps are stored in Database and are served by a python script (say
default_script.py) kept in /var/www/.
Till now, I have blocked Search Engine indexing for directory ( /var/www/ ) using robots.txt. Which essentially blocks indexing of my all scripts including default_script.py as well as content served for multiple webapps using that default_script.py script.
But now I want that some of those subdomains should be indexed.
After searching for a while I was able to figure out a way to block indexing of my scripts by explicitly specifing them in robots.txt
But I am still doubtful about the following:
Will blocking the my default_script.py from indexing also block indexing of all content that are served from default_script.py. If yes then if I let it index, will default_script.py start showing up in search results also.
How can I allow indexing of some of the Subdomains seletively.
Ex: Index subdomain1.xyzdomain.com but NOT subdomain2.xyzdomain.com
|
rename a build in buildbot
| 12,306,901
| 2
| 22
| 812
| 0
|
python,buildbot
|
If you don't care about the name of the directory, just the name of the builder, you can set the builddir attribute of the builder to be whatever it currently is, then name you builder however you want.
The data stored in the builder directory is in pickles. Looking at the code, I think the only data could cause issues is the builder name. If you done care about non-build events, you could probably just delete the builder file from each directory. Otherwise, rewriting the pickle with the update builder name should work.
| 0
| 1
| 0
| 0
|
2012-08-06T23:24:00.000
| 1
| 1.2
| true
| 11,837,330
| 0
| 0
| 0
| 1
|
Is there a way to rename a build in buildbot without losing all of the logs?
For instance I have several windows slaves which all might build: "Windows 2008+ DEBUG" but I want to rename this build to: "Windows 2008R2+ DEBUG".
How do I set compare_attr (if that's even what I need to do) so that all of the logs/etc... are included from the previous builds in the new one.
Can I manually rename the directories and expect everything to work? Experimentation has told me that will not work but maybe I can write a command to change certain things?
|
How to run Python script with one icon click?
| 11,848,690
| 4
| 6
| 15,947
| 0
|
python,ubuntu,compilation,nautilus
|
You should make the .py files executable and click on them. The .pyc files cannot be run directly.
| 0
| 1
| 0
| 0
|
2012-08-07T14:55:00.000
| 3
| 0.26052
| false
| 11,848,650
| 1
| 0
| 0
| 2
|
Sorry, for the vague question, don't know actually how to ask this nor the rightful terminologies for it.
How to run a python script/bytecode/.pyc (any compiled python code) without going through the terminal. Basically on Nautilus: "on double click of the python script, it'll run" or "on select then [Enter], it'll run!". That's my goal at least.
When i check the "Allow executing of file as a program" then press [enter] on the file. It gives me this message:
Could not display "/home/ghelo/Music/arrange.pyc".
There is no application installed for Python bytecode files.
Do you want to search for an application to open this file?
Using Ubuntu 12.04, by the way and has to be python 2, one of the packages doesn't work on python 3. If there's a difference between how to do it on the two version, include it, if it's not to much t ask, thank you.
I know it doesn't matter, but it's a script auto renaming & arranging my music files. Guide me accordingly, stupid idiot here. :)
|
How to run Python script with one icon click?
| 12,015,527
| 1
| 6
| 15,947
| 0
|
python,ubuntu,compilation,nautilus
|
Adding " #!/usr/bin/env python " at the top of the .py file works! Hmm, although don't appreciate the pop-up, but nevermind. :P
From PHPUG:
You do not invoke the pyc file. It's the .py file that's invoked. Python is an interpreted language.
A simpler way to make a python exectuable (explained):
1) Add #!/usr/bin/env python at the top of your python executable file (eg. main.py) (it uses the default python - eg. if using arch, that's py3 instead of py2. You can explicitly tell it to run python2/python3 by replacing python with it's version: ex. python2.7)
2) Write the code. If the script is directly invoked, __name__ variable becomes equal to the string '__main__' thus the idiom: if __name__ == '__main__':. You can add all the logic that relates to your script being directly invoked in this if-block. This keeps your executable importable.
3) Make it executable 'chmod +x main.py'
4) Call the script: ./main.py args args
| 0
| 1
| 0
| 0
|
2012-08-07T14:55:00.000
| 3
| 1.2
| true
| 11,848,650
| 1
| 0
| 0
| 2
|
Sorry, for the vague question, don't know actually how to ask this nor the rightful terminologies for it.
How to run a python script/bytecode/.pyc (any compiled python code) without going through the terminal. Basically on Nautilus: "on double click of the python script, it'll run" or "on select then [Enter], it'll run!". That's my goal at least.
When i check the "Allow executing of file as a program" then press [enter] on the file. It gives me this message:
Could not display "/home/ghelo/Music/arrange.pyc".
There is no application installed for Python bytecode files.
Do you want to search for an application to open this file?
Using Ubuntu 12.04, by the way and has to be python 2, one of the packages doesn't work on python 3. If there's a difference between how to do it on the two version, include it, if it's not to much t ask, thank you.
I know it doesn't matter, but it's a script auto renaming & arranging my music files. Guide me accordingly, stupid idiot here. :)
|
Can I make a script to open terminal and run .py?
| 11,854,667
| 0
| 3
| 4,323
| 0
|
python,macos,terminal
|
Automator would be your best bet actually, creating Macintosh .app bundles by hand can be annoying.
It's been a long time since I've used automator, but here goes, use the Run Shell Script command from Terminal, and make the script be python ~/Desktop/script.py or maybe use the full path like python /Users/<username>/Desktop/script.py
P.S. cd ~/Desktop/script.py doesn't do what you think it does, you want python ~/Desktop/script.py
| 0
| 1
| 0
| 0
|
2012-08-07T20:42:00.000
| 3
| 0
| false
| 11,853,818
| 0
| 0
| 0
| 3
|
I have a simple python script I can run through terminal. Is there a way to put a shortcut on my mac desktop to open terminal and run like "cd ~/Desktop/script.py"? I have tried automator but i couldn't get it to work
|
Can I make a script to open terminal and run .py?
| 11,853,877
| -1
| 3
| 4,323
| 0
|
python,macos,terminal
|
you have to create a samplename.sh file and put the below line and run it ./samplename.sh
~/Desktop/script.py
create symbolic link to that .sh file and place it on desktop.
| 0
| 1
| 0
| 0
|
2012-08-07T20:42:00.000
| 3
| -0.066568
| false
| 11,853,818
| 0
| 0
| 0
| 3
|
I have a simple python script I can run through terminal. Is there a way to put a shortcut on my mac desktop to open terminal and run like "cd ~/Desktop/script.py"? I have tried automator but i couldn't get it to work
|
Can I make a script to open terminal and run .py?
| 11,854,938
| 6
| 3
| 4,323
| 0
|
python,macos,terminal
|
Create a file called anyname.command with python ~/Desktop/script.py in it. Then make it executable by running chmod 555 ~/Desktop/anyname.command in terminal. Then when you double-click on anyname.command it should run the python script.
| 0
| 1
| 0
| 0
|
2012-08-07T20:42:00.000
| 3
| 1.2
| true
| 11,853,818
| 0
| 0
| 0
| 3
|
I have a simple python script I can run through terminal. Is there a way to put a shortcut on my mac desktop to open terminal and run like "cd ~/Desktop/script.py"? I have tried automator but i couldn't get it to work
|
How to change ancestor of an NDB record?
| 11,855,209
| 9
| 5
| 1,422
| 1
|
python,google-app-engine,google-cloud-datastore
|
The only way to change the ancestor of an entity is to delete the old one and create a new one with a new key. This must be done for all child (and grand child, etc) entities in the ancestor path. If this isn't possible, then your listed solution works.
This is required because the ancestor path of an entity is part of its unique key. Parents of entities (i.e., entities in the ancestor path) need not exist, so changing a parent's key will leave the children in the datastore with no parent.
| 0
| 1
| 0
| 0
|
2012-08-07T21:04:00.000
| 1
| 1.2
| true
| 11,854,137
| 0
| 0
| 1
| 1
|
In the High-Replication Datastore (I'm using NDB), the consistency is eventual. In order to get a guaranteed complete set, ancestor queries can be used. Ancestor queries also provide a great way to get all the "children" of a particular ancestor with kindless queries. In short, being able to leverage the ancestor model is hugely useful in GAE.
The problem I seem to have is rather simplistic. Let's say I have a contact record and a message record. A given contact record is being treated as the ancestor for each message. However, it is possible that two contacts are created for the same person (user error, different data points, whatever). This situation produces two contact records, which have messages related to them.
I need to be able to "merge" the two records, and bring put all the messages into one big pile. Ideally, I'd be able to modify ancestor for one of the record's children.
The only way I can think of doing this, is to create a mapping and make my app check to see if record has been merged. If it has, look at the mappings to find one or more related records, and perform queries against those. This seems hugely inefficient. Is there more of "by the book" way of handling this use case?
|
Swapy could not be used to access swing properties of swing based java application.How to access swing properties of a java application
| 12,048,644
| 5
| 0
| 1,126
| 0
|
python,swing,ui-automation,pywinauto
|
Pywinauto uses standard windows API calls. Unfortunately many UI libraries (like Swing/QT/GTK) do not respond in a typical way to the API calls used - so unfortunately pywinauto usually cannot get the control information. (I am the Author of pywinauto).
I can't give you a way to access the properties of the Swing controls.
| 0
| 1
| 0
| 0
|
2012-08-08T08:07:00.000
| 1
| 1.2
| true
| 11,860,280
| 0
| 0
| 1
| 1
|
I am using swapy(desktop automation tool which uses pywinauto python package) to automate desktop UI activities, but swapy does not recognize the properties of a swing based java application, but it can recognize the properties of other applications like notepad windows media player etc..
can anybody please the reason for this problem
and
can I use swing explorer for this swing based application of which I don not have code, just the application
If i cant use it, please give me a way/solution to access the properties of swing based java application.
Thanks in advance..
|
Installing 3rd party Python modules on an Ubuntu Linux machine?
| 31,068,954
| 0
| 13
| 63,583
| 0
|
python,module
|
To install nay python package in ubuntu, first run
sudo apt-get update
Then type "sudo apt-get install python-" and press tab twice repeatedly.
press y or yes and it will display all the packages available for python. Then again type
sudo apt-get install python-package
It will install the package from the internet.
| 0
| 1
| 0
| 1
|
2012-08-09T23:11:00.000
| 5
| 0
| false
| 11,893,311
| 0
| 0
| 0
| 2
|
I'm guessing my question is pretty basic, but after 15-20 minutes on Google and YouTube, I am still a little fuzzy. I am relatively new to both Linux and Python, so I am having some difficulty comprehending the file system tree (coming from Windows).
From what I've found digging around the directories in Ubuntu (which is version 12.04, I believe, which I am running in VBox), I have ID'd the following two directories related to Python:
/usr/local/lib/python2.7 which contains these two subdirectories:
dist-packages
site-packages
both of which do not show anything when I type "ls" to get a list of the files therein, but show ". .." when I type "ls -a".
/usr/lib/python2.7 which has no site-packages directory but does have a dist-packages directory that contains many files and subdirectories.
So if I want to install a 3rd party Python module, like, say, Mechanize, in which one of the above directories (and which subdirectory), am I supposed to install it in?
Furthermore, I am unclear on the steps to take even after I know where to install it; so far, I have the following planned:
Download the tar.gz (or whatever kind of file the module comes in) from whatever site or server has it
Direct the file to be unzipped in the appropriate subdirectory (one of the 2 listed above)
Test to make sure it works via import mechanize in interactive mode.
Lastly, if I want to replace step number 1 above with a terminal command (something like sudo apt-get), what command would that be, i.e., what command via the terminal would equate to clicking on a download link from a browser to download the desired file?
|
Installing 3rd party Python modules on an Ubuntu Linux machine?
| 11,893,356
| 11
| 13
| 63,583
| 0
|
python,module
|
You aren't supposed to manually install anything.
There are three ways to install Python libraries:
Use apt-get, aptitude or similar utilities.
Use easy_install or pip (install pip first, its not available by default)
If you download some .tar.gz file, unzip it and then type sudo python setup.py install
Manually messing with paths and moving files around is the first step to headaches later. Do not do it.
For completeness I should mention the portable, isolated way; that is to create your own virtual environment for Python.
Run sudo apt-get install python-virtualenv
virtualenv myenv (this creates a new virtual environment. You can freely install packages in here without polluting your system-wide Python libraries. It will add (myenv) to your prompt.)
source myenv/bin/activate (this activates your environment; making sure your shell is pointing to the right place for Python)
pip install _____ (replace __ with whatever you want to install)
Once you are done type deactivate to reset your shell and environment to the default system Python.
| 0
| 1
| 0
| 1
|
2012-08-09T23:11:00.000
| 5
| 1
| false
| 11,893,311
| 0
| 0
| 0
| 2
|
I'm guessing my question is pretty basic, but after 15-20 minutes on Google and YouTube, I am still a little fuzzy. I am relatively new to both Linux and Python, so I am having some difficulty comprehending the file system tree (coming from Windows).
From what I've found digging around the directories in Ubuntu (which is version 12.04, I believe, which I am running in VBox), I have ID'd the following two directories related to Python:
/usr/local/lib/python2.7 which contains these two subdirectories:
dist-packages
site-packages
both of which do not show anything when I type "ls" to get a list of the files therein, but show ". .." when I type "ls -a".
/usr/lib/python2.7 which has no site-packages directory but does have a dist-packages directory that contains many files and subdirectories.
So if I want to install a 3rd party Python module, like, say, Mechanize, in which one of the above directories (and which subdirectory), am I supposed to install it in?
Furthermore, I am unclear on the steps to take even after I know where to install it; so far, I have the following planned:
Download the tar.gz (or whatever kind of file the module comes in) from whatever site or server has it
Direct the file to be unzipped in the appropriate subdirectory (one of the 2 listed above)
Test to make sure it works via import mechanize in interactive mode.
Lastly, if I want to replace step number 1 above with a terminal command (something like sudo apt-get), what command would that be, i.e., what command via the terminal would equate to clicking on a download link from a browser to download the desired file?
|
How can we transfer large amounts of data over a network, using Python?
| 11,895,345
| 3
| 1
| 723
| 0
|
python,networking,file-transfer
|
I think your best bet is to use scp or rsync from within screen. That way you can detach the screen session and logout and the transfer will keep going.
man screen
| 0
| 1
| 0
| 1
|
2012-08-10T04:00:00.000
| 1
| 1.2
| true
| 11,895,298
| 0
| 0
| 0
| 1
|
I am working on a task to back up (copy) about 100 Gb of data (including a thousand files and sub folders in a directory) to another server. Normally, for the smaller scale, I can use scp or rsync instead. However, as the other server is not on the same LAN network, it could easily take hours, even days, to complete the task. I can't just leave my computer there with the terminal running. I don't think that's the best choice, and again, I have another good reason to use Python :)
Is there any library, or best practice for me to start with? As, it's just for in-house project, we don't need any fancy features, just some fundamental things such as logging, error tolerance, etc.
|
How can I check programmatically the status of my task queue in Google Appengine?
| 11,903,487
| 0
| 6
| 585
| 0
|
python,google-app-engine,queue
|
There is a task queue link on your appengine console where you can look at the pending tasks, statistics and see what's going on.
| 0
| 1
| 0
| 0
|
2012-08-10T13:41:00.000
| 2
| 0
| false
| 11,902,954
| 0
| 0
| 1
| 1
|
I am firing up a queue to complete some tasks in Python Appengine application. Is there a way to get the status of the queue? I would like to check whether it is still running or has incomplete tasks.
|
How to deal with deployments to a single host with multiple application servers using Fabric?
| 11,918,085
| 2
| 3
| 202
| 0
|
python,host,fabric
|
It's just python so do what you need to do to keep them seperate. You can define the dir differences in a dictionary or some yaml file that's read into the script. There isn't anything made in fabric to make you do it one way nor provide any specific way to do this.
But essentially just keep in mind that it's not a DSL, it's a full python file, and you'll stumble onto what works best for you and your environment.
| 0
| 1
| 0
| 0
|
2012-08-10T23:00:00.000
| 1
| 0.379949
| false
| 11,910,295
| 0
| 0
| 1
| 1
|
I have many application servers running on the same host. Every application server is installed in a different directory.
How should I tackle deployments on the servers, using Fabric? I would like to be able to perform deployments on each server separately, and on subsets of servers. Clearly the env.hosts parameter has no use here, since all servers are on the same host. Same goes for the env.roledefs parameter. These come in handy when every server is installed on a different host.
How should I deal with grouping of the servers, and setting separate environment parameters for each one of them which the fab tool can read and apply.
|
keeping libraries at correct place when multiple pythons are installed
| 11,912,085
| 1
| 1
| 65
| 0
|
python,opencv
|
When you configure your interpreter in eclipe (either the first time, or by going to the preferences menu) you need to select an interpreter (don't use the auto-configuration).
Eclipe will use that interpreter, and libraries relative to it. If you install new libraries, just go back to prefrences>pydev>interpreter, and click "Apply" on the screen where the interpreters are selected (you don't need to change anything, but new libraries will be scanned for).
I recomend using ports, if possible, since you'll most likely find everything you need there and won't have to deal with any manual installation of modules.
| 0
| 1
| 0
| 0
|
2012-08-11T05:01:00.000
| 1
| 0.197375
| false
| 11,912,049
| 1
| 0
| 0
| 1
|
QUESTION1:I have 3 versions of pythons installed in my mac.
1.Apple supplied one (2.7.1) (/usr/local/bin)
2.Macports installed one (2.7.3) (/opt/local/bin)
3.and one from python.org (2.7.3) (/Library/Frameworks/Python.framework/Versions/2.7/bin)
I would like to add external modules like opencv,pygame.I have no idea where the installed binaries are going and when I try to import them I get this "no module found" error.How to make macports installed python and python.org installed python use opencv module or some other external modules.
QUESTION2:How to add external libraries to pydev in eclipse
|
Cron job on Appengine - first time on start?
| 11,918,536
| 2
| 0
| 211
| 0
|
python,google-app-engine,cron
|
There is no "launch" the app in production as such. You deploy the app for the first time and crontab is now present and crontab scheduling is started. So I assume you really mean you would like to run the cron job every time you deploy a new version of your application in addition to the cron schedule.
The cron handler is callable by you, so why not just wrap appcfg in a script that calls the cron handler after you do the deploy. Use wget/curl etc.....
| 0
| 1
| 0
| 1
|
2012-08-11T21:37:00.000
| 1
| 0.379949
| false
| 11,917,869
| 0
| 0
| 1
| 1
|
I am successfully running a cron job every hour on Google Appengine. However I would like it to start when I launch the app. Now it does the first cron job 1 hour after the start.
I am using Python.
|
Aptana getting path of Windows python interpreter instead of linux
| 12,043,683
| 0
| 0
| 124
| 0
|
aptana,ubuntu-10.04,pythonpath
|
I just changed the workspace and it works fine now. After doing so it asked for some paths for interpreter and I gave that and it works fine now.
| 0
| 1
| 0
| 1
|
2012-08-12T03:11:00.000
| 1
| 1.2
| true
| 11,919,437
| 0
| 0
| 0
| 1
|
I was working on a project using windows in Aptana. I changed my OS and installed ubuntu on unpartitioned space. I again downloaded Aptana for ubuntu and run it. I specified same workspace that I was using during windows as my that project partition is still there.
The problem I am having is that I am unable to use Aptana intelligence so should I change some paths e.t.c. or is there a way to remove data from workspace(data that tells info to aptana) and recreate project so that it take new info. I tried to see that data but didn't see data that aptana use from workspace or project directory.
Please tell what should be done in this sitaution. thanks in advance guys.
|
How to change the path of Python in Spyder?
| 53,098,634
| 0
| 25
| 92,641
| 0
|
python,ide,path,spyder
|
Execute the following command: %cd"P:\Python"
| 0
| 1
| 0
| 0
|
2012-08-12T03:59:00.000
| 4
| 0
| false
| 11,919,615
| 1
| 0
| 0
| 3
|
I'm using Debian. I installed Python 3.2.3. The path of Python 3 is /usr/bin/python3.
How do I change it in Spyder?
|
How to change the path of Python in Spyder?
| 12,355,200
| 36
| 25
| 92,641
| 0
|
python,ide,path,spyder
|
Press CTRL+SHIFT+ALT+P to open the Preferences window. Within this window, select the Console item on the left, then the Advanced Settings tab. The path to the Python executable will be right there.
| 0
| 1
| 0
| 0
|
2012-08-12T03:59:00.000
| 4
| 1.2
| true
| 11,919,615
| 1
| 0
| 0
| 3
|
I'm using Debian. I installed Python 3.2.3. The path of Python 3 is /usr/bin/python3.
How do I change it in Spyder?
|
How to change the path of Python in Spyder?
| 49,143,964
| 0
| 25
| 92,641
| 0
|
python,ide,path,spyder
|
simple if your not able to change the working directory .Press CTRL+SHIFT+ALT+P to open the Preferences window then go to RUN then see the working directory options and finally press the option THE CURRENT WORKING DIRECTORY.
| 0
| 1
| 0
| 0
|
2012-08-12T03:59:00.000
| 4
| 0
| false
| 11,919,615
| 1
| 0
| 0
| 3
|
I'm using Debian. I installed Python 3.2.3. The path of Python 3 is /usr/bin/python3.
How do I change it in Spyder?
|
Secured communication between two web servers (Amazon EC2 with Django and Google App Engine)
| 11,960,819
| 1
| 3
| 705
| 0
|
python,django,google-app-engine,amazon-ec2,urllib
|
For server to server communication, traditional security advice would recommend some sort of IP range restriction at the web server level for the URLs in addition to whatever default security is in place. However, since you are making the call from a cloud provider to another cloud provider, your ability to permanently control the IP address of either the client and the server may diminished.
That said, I would recommend using a standard username/password authentication mechanism and HTTPS for transport security. A basic auth username/password would be my recommendation(https:\\username:password@appengine.com\). In addition, I would make sure to enforce a lockout based on a certain number of failed attempts in a specific time window. This would discourage attempts to brute force the password.
Depending on what web framework you are using on the App Engine, there is probably already support for some or all of what I just mentioned. If you update this question with more specifics on your architecture or open a new question with more information, we could give you a more accurate recommendation.
| 0
| 1
| 0
| 0
|
2012-08-13T20:49:00.000
| 3
| 0.066568
| false
| 11,942,094
| 0
| 0
| 1
| 2
|
I have a website which uses Amazon EC2 with Django and Google App Engine for its powerful Image API and image serving infrastructure. When a user uploads an image the browser makes an AJAX request to my EC2 server for the Blobstore upload url. I'm fetching this through my Django server so I can check whether the user is authenticated or not and then the server needs to get the url from the App Engine server. After the upload is complete and processed in App Engine I need to send the upload info back to the django server so I can build the required model instances. How can I accomplish this? I was thinking to use urllib but how can I secure this to make sure the urls will only get accessed by my servers only and not by a web user? Maybe some sort of secret key?
|
Secured communication between two web servers (Amazon EC2 with Django and Google App Engine)
| 11,960,193
| 2
| 3
| 705
| 0
|
python,django,google-app-engine,amazon-ec2,urllib
|
apart from the Https call ( which you should be making to transfer info to django ), you can go with AES encryption ( use Pycrypto/ any other lib). It takes a secret key to encrypt your message.
| 0
| 1
| 0
| 0
|
2012-08-13T20:49:00.000
| 3
| 1.2
| true
| 11,942,094
| 0
| 0
| 1
| 2
|
I have a website which uses Amazon EC2 with Django and Google App Engine for its powerful Image API and image serving infrastructure. When a user uploads an image the browser makes an AJAX request to my EC2 server for the Blobstore upload url. I'm fetching this through my Django server so I can check whether the user is authenticated or not and then the server needs to get the url from the App Engine server. After the upload is complete and processed in App Engine I need to send the upload info back to the django server so I can build the required model instances. How can I accomplish this? I was thinking to use urllib but how can I secure this to make sure the urls will only get accessed by my servers only and not by a web user? Maybe some sort of secret key?
|
Website sync of contacts and reminders with iCloud
| 11,973,429
| 1
| 4
| 1,657
| 0
|
php,python,api,sync,icloud
|
To the best of my knowledge, there is no way to interface with iCloud directly; it can only be done through an iOS or Mac OS app, and by calling the correct iCloud Objective-C APIs with UI/NSDocument classes. Since you are not using Cocoa, let alone Objective-C, you will most likely not be able to do this. I may be wrong of course, as I haven't conducted an in-depth search into this.
| 0
| 1
| 0
| 0
|
2012-08-15T13:23:00.000
| 4
| 0.049958
| false
| 11,970,079
| 0
| 0
| 1
| 2
|
I'm building custom CRM web based system and have integrated synchronization of contacts and reminders with Google apps and need do the same with Apple iCloud. Is there any way how to do it? I haven't find any official API for this purpose, CRM is written in PHP, but I'm able to use python for this purpose as well.
|
Website sync of contacts and reminders with iCloud
| 12,255,882
| 0
| 4
| 1,657
| 0
|
php,python,api,sync,icloud
|
I would recommend that you sync using the google contacts api. Then, you can tell iPhone people to use that instead of iCloud.
| 0
| 1
| 0
| 0
|
2012-08-15T13:23:00.000
| 4
| 0
| false
| 11,970,079
| 0
| 0
| 1
| 2
|
I'm building custom CRM web based system and have integrated synchronization of contacts and reminders with Google apps and need do the same with Apple iCloud. Is there any way how to do it? I haven't find any official API for this purpose, CRM is written in PHP, but I'm able to use python for this purpose as well.
|
How to run PyCharm using port 80
| 38,212,424
| 2
| 8
| 8,103
| 0
|
python,django,pycharm
|
To give PyCharm permissions, one has to run as Administor (Windows) or using sudo if on OSX/Linux: sudo /Applications/PyCharm.app/Contents/MacOS/pycharm. Note that this truly runs PyCharm as a new user, so you'll have to register the app again and set up your customizations again if you have any (ie theme, server profiles etc)
| 0
| 1
| 0
| 0
|
2012-08-16T13:49:00.000
| 4
| 0.099668
| false
| 11,988,636
| 0
| 0
| 0
| 2
|
I can't run my PyCharm IDE using port 80.
I need to use PayPal that requires me to use port 80.
But using Mac OS X 10.8 I can't have it working because of permission issues.
I've already tried running PyCharm with SUDO command.
Does anyone know how to run Pycharm using port 80, or any other solution?
Thanks.
|
How to run PyCharm using port 80
| 22,296,578
| 1
| 8
| 8,103
| 0
|
python,django,pycharm
|
For the ones who are looking for the answer of this question, please check your Pycharm Run/Debug Configurations. Run->Edit Configurations ->Port
| 0
| 1
| 0
| 0
|
2012-08-16T13:49:00.000
| 4
| 0.049958
| false
| 11,988,636
| 0
| 0
| 0
| 2
|
I can't run my PyCharm IDE using port 80.
I need to use PayPal that requires me to use port 80.
But using Mac OS X 10.8 I can't have it working because of permission issues.
I've already tried running PyCharm with SUDO command.
Does anyone know how to run Pycharm using port 80, or any other solution?
Thanks.
|
Calling pdb.set_trace from script invoked from os.system
| 12,004,423
| 0
| 0
| 132
| 0
|
python,pdb
|
If you are using output redirection, the pdb prompt will be redirected as well.
| 0
| 1
| 0
| 0
|
2012-08-17T05:50:00.000
| 1
| 1.2
| true
| 12,000,436
| 0
| 0
| 0
| 1
|
I want to debug a python script which is invoked via os.system() from another python script. I tried calling pdb.set_trace from the invoked code but it doesn't work. I can't see the Python pdb prompt.
Its sort of automation framework. My final python script where i want to put set_trace is like:
python script1.py --invokes--> script2.py --invokes--> script3.py (Here, in script3.py my set_trace is )
I'm working on linux with python 2.4
|
Web server to run python code
| 12,027,902
| 1
| 0
| 223
| 0
|
python,webserver,hosting
|
Go for Amazon Ec2 instance, Ubantu server. If your process is not much memory consuming , you can go with Micro instance(617 Mb ram, 8 Gb HD) which is free for first year. Or you could go with small instance (1.7 GB ram and 8Gb HD), which might cost you little more.
For setting up the python code to run 24/7 , you can create a daemon process in the instance. You can also put the twisted library/ any other library in it. Should not take much time if you have worked with Amazon AWS.
| 0
| 1
| 1
| 0
|
2012-08-19T15:49:00.000
| 2
| 1.2
| true
| 12,027,815
| 0
| 0
| 0
| 1
|
I'm sorry if my question is too elementary. I have some python code, which makes the machine act as a transparent proxy server using "twisted" library. Basically I want my own transparent proxy OUTSIDE my internal network and since I want to be able to monitor traffic, I need to have my own server. So I need a machine that runs my script 24/7 and listens for http connections. What kind of server/host do I need? Any host provider suggestions?
|
Making a job fail in jenkins
| 70,767,921
| 0
| 8
| 15,709
| 0
|
python,jenkins
|
I came across this as a noob and found the accepted answer is missing something if you're running python scripts through a Windows batch shell in Jenkins.
In this case, Jenkins will only fail if the very last command in the shell fails. So your python command may fail but if there is another line after it which changes directory or something then Jenkins will believe the shell was successful.
The solution is to check the error level after the python line:
if %ERRORLEVEL% NEQ 0 (exit)
This will cause the shell to exit immediately if the python line fails, causing Jenkins to be marked as a fail because the last line on the shell failed.
| 0
| 1
| 0
| 1
|
2012-08-20T11:11:00.000
| 4
| 0
| false
| 12,036,620
| 0
| 0
| 0
| 1
|
This question might sound weird, but how do I make a job fail?
I have a python script that compiles few files using scons, and which is running as a jenkins job. The script tests if the compiler can build x64 or x86 binaries, I want the job to fail if it fails to do one of these.
For instance: if I'm running my script on a 64-bit system and it fails to compile a 64-bit. Is there something I can do in the script that might cause to fail?
|
Data analysis using MapReduce in MongoDb vs a Distributed Queue using Celery & RabbitMq
| 12,079,563
| 0
| 1
| 944
| 0
|
python,mongodb,mapreduce,celery,distributed-computing
|
It's impossible to say without benchmarking for certain, but my intuition leans toward doing more calculations in Python rather than mapreduce. My main concern is that mapreduce is single-threaded: One MongoDB process can only run one Javascript function at a time. It can, however, serve thousands of queries simultaneously, so you can take advantage of that concurrency by querying MongoDB from multiple Python processes.
| 0
| 1
| 0
| 0
|
2012-08-20T21:13:00.000
| 1
| 0
| false
| 12,045,278
| 0
| 1
| 0
| 1
|
I am currently working on a project which involves performing a lot of statistical calculations on many relatively small datasets. Some of these calculations are as simple as computing a moving average, while others involve slightly more work, like Spearman's Rho or Kendell's Tau calculations.
The datasets are essentially a series of arrays packed into a dictionary, whose keys relate to a document id in MongoDb that provides further information about the subset. Each array in the dictionary has no more than 100 values. The dictionaries, however, may be infinitely large. In all reality however, around 150 values are added each year to the dictionary.
I can use mapreduce to perform all of the necessary calculations. Alternately, I can use Celery and RabbitMQ on a distributed system, and perform the same calculations in python.
My question is this: which avenue is most recommended or best-practice?
Here is some additional information:
I have not benchmarked anything yet, as I am just starting the process of building the scripts to compute the metrics for each dataset.
Using a celery/rabbitmq distributed queue will likely increase the number of queries made against the Mongo database.
I do not envision the memory usage of either method being a concern, unless the number of simultaneous tasks is very large. The majority of the tasks themselves are merely taking an item within a dataset, loading it, doing a calculation, and then releasing it. So even if the amount of data in a dataset is very large, not all of it will be loaded into memory at one time. Thus, the limiting factor, in my mind, comes down to the speed at which mapreduce or a queued system can perform the calculations. Additionally, it is dependent upon the number of concurrent tasks.
Thanks for your help!
|
Using Multiple Installations of Celery with a Redis Backend
| 12,089,960
| 2
| 13
| 4,720
| 0
|
python,redis,celery
|
I've used a redis backend for celery while also using the same redis db with prefixed cache data. I was doing this during development, I only used redis for the result backend not to queue tasks, and the production deployment ended up being all AMQP (redis only for caching). I didn't have any problems and don't see why one would (other than performance issues).
For running multiple celery projects with different task definitions, I think the issue would be if you have two different types of workers that each can only handle a subset of job types. Without separate databases, I'm not sure how the workers would be able to tell which jobs they could process.
I'd probably either want to make sure all workers had all task types defined and could process anything, or would want to keep the separate projects in separate databases. This wouldn't require installing anything extra, you'd just specify a REDIS_DB=1 in one of your celery projects. There might be another way to do this. I don't know for sure that multiple DBs are required, but it kinda makes sense.
If you're only using redis for a result backend, maybe that would work for having multiple celery projects on one redis db... I'm not really sure.
| 0
| 1
| 0
| 0
|
2012-08-21T09:39:00.000
| 2
| 1.2
| true
| 12,052,094
| 0
| 0
| 1
| 1
|
Is it possible to use the same redis database for multiple projects using celery? Like using the same database for multiple projects as a cache using a key prefix. Or do i have to use a seperate database for every installation?
|
Routine in python to test for a string if has a *nix valid absolute path?
| 12,057,654
| 0
| 0
| 334
| 0
|
python,python-2.7,filepath
|
If I understand you, your first example IS an absolute path. All absolute paths will start with a "/" as they must start at the root directory, and all relative paths will not. So, just check if your string starts with a "/" using str.startswith('/'). Then, if you want to check if the path is valid, then use os.path.exists().
Your second example is not a *nix path.
| 0
| 1
| 0
| 0
|
2012-08-21T14:42:00.000
| 3
| 0
| false
| 12,057,379
| 1
| 0
| 0
| 2
|
I need a routine in python to test for a string that contains an absolute path, that is Unix style format.
So that /home/eduard/tmp/chrome-data-dir/file.ext would be a valid path.
But C:\Users\user\AppData\Local\Google\Chrome\Application\chrome.exe would not be a valid path.
I need also the path to bet tested not contain characters that might be consider special like: *,?
|
Routine in python to test for a string if has a *nix valid absolute path?
| 12,057,424
| 0
| 0
| 334
| 0
|
python,python-2.7,filepath
|
Your first example is not a relative path, it's absolute because it begins with /. The second is also absolute, since the first character after the drive name is a \.
A relative path in Unix would be something like chrome-data-dir/file.ext or ../../include/.
Your question is kind of unclear.
Perhaps you should look for a colon?
| 0
| 1
| 0
| 0
|
2012-08-21T14:42:00.000
| 3
| 0
| false
| 12,057,379
| 1
| 0
| 0
| 2
|
I need a routine in python to test for a string that contains an absolute path, that is Unix style format.
So that /home/eduard/tmp/chrome-data-dir/file.ext would be a valid path.
But C:\Users\user\AppData\Local\Google\Chrome\Application\chrome.exe would not be a valid path.
I need also the path to bet tested not contain characters that might be consider special like: *,?
|
How can I copy files in Python while keeping their directory structure?
| 12,060,469
| 2
| 0
| 3,371
| 0
|
python,copy,directory,file-copying
|
You need to use os.makedirs along side shutil.copytree.
| 0
| 1
| 0
| 0
|
2012-08-21T17:53:00.000
| 2
| 0.197375
| false
| 12,060,358
| 0
| 0
| 0
| 1
|
I have a list of directories which have many sub-directories.
e.x. C:\home\test\myfiles\myfile.txt
I want to copy this to my X: drive. How do I copy myfile.txt if the X: drive only contains X:\\home?
I thought shutil would create necessary directories when copying files but I was wrong and I am not sure what to use.
Worded another way...
I want to copy C:\\home\\test\\myfiles\\myfile.txt to X:\\home\\test\\myfiles\\myfile.txt but X:\\home\\test\\myfiles does not exist.
Thanks!
|
porting python code(linux) to windows
| 12,061,400
| 3
| 2
| 1,172
| 0
|
python,linux
|
I only have experience with py2exe and pyqt4, but py2exe needs several dlls which can only exist inside a Windows environment (like Visual C runtime libs or the dlls for Qt). It might be hackable with Wine, but having a Windows environment for packaging everything is the "supported" way.
| 0
| 1
| 0
| 0
|
2012-08-21T18:55:00.000
| 2
| 0.291313
| false
| 12,061,262
| 1
| 0
| 0
| 1
|
i wrote a program using python with PyQT4 and other modules like numpy, scipy etc. under Linux(Ubuntu 9.10). Now i want a executable of this program under Windows 7. I dont want to install Python on the Windows 7 OS.
i try pyinstaller, cx_freeze and py2exe under linux, but i generate only a linux executable which works fine under linux but not working under Windows.
Now my Questions are.
Is my Task possible or need i to install Python and the needed packages on Windows 7 to generate the executable with pyinstaller for examble?
if it is possible--> how is the solution to solve the problem.
regards lars
|
synchronize two pipelines in gstreamer
| 12,079,062
| 3
| 0
| 3,138
| 0
|
python,gstreamer
|
Depends on what you mean by synchronization, what are your sources and what is your pipeline. If both are getting data from different sources unless the sources were synchronized in some form there is no real sense to what you mean by synchronize the two pipelines
If all you want is that they are in lock step with each other irrespective of what their source offsets were, as long as you have a clock based pipeline they will remain so. [say you are capturing from two usb cameras]. As long as the system is fast enough to run the 2 pipelines in real time they will remain in real time.
If you just want to display the two side by side irrespective of the initial offsets between them use videomixer and place them side by side. It will automatically ensure the two are synchronized in the sense that the videos will move in lock step with each other
If you want them to be synchronized on basis of the timestamps then you have to use RTSP. Send the output from both the pipelines to a gstrtpbin and from the single gstrtpbin you can get synchronized streams. This is slightly non trivial.
| 0
| 1
| 0
| 0
|
2012-08-22T17:04:00.000
| 1
| 0.53705
| false
| 12,078,046
| 0
| 0
| 0
| 1
|
I am playing 2 videos in two different pipelines of gstreamer. I would like to synchronize both the videos. do any of you have any tips?
|
Command Prompt Python
| 12,083,132
| 1
| 0
| 271
| 0
|
python,terminal,progress-bar,command-prompt
|
Each IDE is infact interacting via the command line and redirecting streams into it's implementation of showing those outputs, Each IDE has it's own way of doing this, command prompt is more powerful if you are expeirienced and easy to try one off scripts, try ipython which is great for beginners and learners alike for fast access to the programming environment and trying out module.
| 0
| 1
| 0
| 0
|
2012-08-22T23:46:00.000
| 2
| 0.099668
| false
| 12,082,918
| 1
| 0
| 0
| 1
|
What is the benefit of running code through the command prompt/terminal vs an ide?
I've noticed recently when using the progressbar module of python that the progress text is updated on the same line in the command prompt window while the ide prints each text on the next line. Why are these different? Are they not running though the same interpreter?
|
Set up python path in mac osx?
| 12,083,839
| 0
| 3
| 14,852
| 0
|
python,macos,python-2.7
|
If I remember correctly, you may want to do a "sudo port activate python". What does "which python" tell you? If it's /usr/bin/python, you're running OSX Python. If, OTOH, it's /usr/local/bin/python you're probably using the ports version.
| 0
| 1
| 0
| 0
|
2012-08-23T01:39:00.000
| 2
| 0
| false
| 12,083,640
| 1
| 0
| 0
| 1
|
I installed python on mac os (mountain lion) with Macports.
When I run
$python
It gives an error on "cannot import urandom" when I try to import pandas or matplotlib.
If I run
$python 2.7
Everything runs perfectly.
I want to change python to use python2.7 always.
I tried using sudo port select python python27. But that didn't help.
Please help me on this, I'm new to mac.
|
Where does os.remove go?
| 12,094,678
| 5
| 13
| 7,445
| 0
|
python
|
it just deletes them from the harddrive
| 0
| 1
| 0
| 0
|
2012-08-23T15:02:00.000
| 2
| 0.462117
| false
| 12,094,663
| 0
| 0
| 0
| 2
|
I've been using Python for a long time and have numerous scripts running all over my office. I use a few in particular scripts to back up then delete data. In these script I use os.remove function.
My question is: Where does the os.remove function delete items to?
Does it delete them right off the HD?
I know they don't go to the recycle bin
Does it simply remove the item's link, but keep it on the HD somehow?
|
Where does os.remove go?
| 12,094,722
| 24
| 13
| 7,445
| 0
|
python
|
os.remove
will call the operating system's unlink functionality, and delete the file from the disk.
Technically the OS/filesystem probably just marks the sectors as free, and removes the file entry from the directory, but that's up to the filesystem implementation.
| 0
| 1
| 0
| 0
|
2012-08-23T15:02:00.000
| 2
| 1.2
| true
| 12,094,663
| 0
| 0
| 0
| 2
|
I've been using Python for a long time and have numerous scripts running all over my office. I use a few in particular scripts to back up then delete data. In these script I use os.remove function.
My question is: Where does the os.remove function delete items to?
Does it delete them right off the HD?
I know they don't go to the recycle bin
Does it simply remove the item's link, but keep it on the HD somehow?
|
How can I trigger a function anytime there is a new session in a GAE/Python Application?
| 12,116,756
| 0
| 0
| 412
| 0
|
python,google-app-engine
|
I am trying to be pretty general here as I don't know whether you are using the default users service or not and I don't know how you are uniquely linking your SessionSupplemental entities to users or whether you even have a way to identify users at this point. I am also assuming you are using some version of webapp as that is the standard request handling library on App Engine. Let me know a bit more and I can update the answer to be more specific.
Subclass the default RequestHandler in webapp with a new class (such as MyRequestHandler).
In your subclass override the initialize() method.
In your new initialize() method get the current user from your session system (or the users service or whatever you are using). Test to see if a SessionSupplemental entity already exists for this user and if not create a new one.
For all your other request handlers you now want to subclass MyRequestHandler (instead of the default RequestHandler).
Whenever a request happens webapp will automatically call the initialize() method.
This is going to cost you a read for every request and also a write for every request by a new user. If you use the ndb library (instead of db) then a lot of the requests will just hit memcache instead of the datastore.
Now if you are just starting creating a new AppEngine app I would recommend using the Python27 runtime and webapp2 and trying to leverage as much of the webapp2 Auth module as you can so you don't have to write so much session stuff yourself. Also, ndb can be much nicer than the default db library.
| 0
| 1
| 0
| 0
|
2012-08-23T19:01:00.000
| 1
| 0
| false
| 12,098,358
| 0
| 0
| 1
| 1
|
I am a newbie to Google App Engine and Python.
I want to create an entry in a SessionSupplemental table (Kind) anytime a new user accesses the site (regardless of what page they access initially).
How can I do this?
I can imagine that there is a list of standard event triggers in GAE; where would I find these documented? I can also imagine that there are a lot of system/application attributes; where can I find these documented and how to use them?
Thanks.
|
how to set python IDLE's default python?
| 12,102,132
| 1
| 5
| 1,564
| 0
|
python,windows-7
|
The IDLE context menu plug-in is registered when you install Python and points to the version of IDLE supplied with the Python installed. (IDLE itself has significant code changes between Python 2 and 3 because it's written in Python and the language changed a lot.) To change it, simply re-install the version of Python you wish the IDLE context menu to invoke.
| 0
| 1
| 0
| 0
|
2012-08-24T01:15:00.000
| 1
| 0.197375
| false
| 12,102,061
| 1
| 0
| 0
| 1
|
I installed python 3.2 and later installed python 2.7. Somehow the IDLE, which I open it by right-click on python file -> Edit with IDLE, are using python 2.7 instead of python 3.2.
It seems that python 2.7 was set as default with IDLE. Even if I changed the PATH environment variable in windows advance setting back to python 3.2, the default python shell is still 2.7. I am sure that there was no more python 2.7 in the path.
Later I have to uninstall python 2.7 and reinstall python 3.2.
|
Executing a python script in a subprocess - with graphics
| 12,106,760
| 1
| 0
| 973
| 0
|
python,wxpython
|
I don't no much about wx, I work with jython(python implemented in java and you can use java) and swing. Swing has its own worker thread, and if you do gui updates you wrap your code into a runnable and invoke it with swing.invokelater.
You could see if wx has something like that, if you however are only allowed to manipulate the gui from the thread in which you created it try something similar. create a proxy object for your gui, which forwards all your calls to your thread which forwards them to the gui.
But proxying like this gets messy. how about you let them define classes, with an 'updateGui' function, that they should hand back to you over a queue and that you will execute in your gui thread.
| 0
| 1
| 0
| 0
|
2012-08-24T08:38:00.000
| 4
| 0.049958
| false
| 12,105,855
| 1
| 0
| 0
| 1
|
I've seen a lot of stuff about running code in subprocesses or threads, and using the multiprocessing and threading modules it's been really easy. However, doing this in a GUI adds an extra layer of complication.
From what I understand, the GUI classes don't like it if you try and manipulate them from multiple threads (or processes). The workaround is to send the data from whatever thread you created it in to the thread responsible for the graphics and then render it there.
Unfortunately, for the scenario I have in mind this is not an option: The gui I've created allows users to write their own plotting code which is then executed. This means I have no control over how they plot exactly, nor do I want to have it. (Update: these plots are displayed in separate windows and don't need to be embedded anywhere in the main GUI. What I want is for them to exist separated from the main GUI, without sharing any of the underlying stack of graphics libraries.)
So what I'm wondering now is
Is there some clean(ish) way of executing a string of python code in a whole new interpreter instance with its own ties to the windowing system?
In response to the comments:
The current application is set up as follows: A simple python script loads a wxPython gui (a wx.App). Using this gui users can set up a simulation, part of which involves creating a script in plain python that runs the simulation and post-processes the results (which usually involves making plots and displaying them). At the moment I'm doing this by simply calling exec() on the script code. This works fine, but the gui freezes while the simulation is running. I've experimented with running the embedded script in a subprocess, which also works fine, right up until you try to display the created graphs (usually using matplotlib's show()). At this point some library deep down in the stack of wxPython, wx, gtk etc starts complaining because you cannot manipulate it from multiple threads.
The set-up I would like to have is roughly the same, but instead of the embedded script sharing a GUI with the main application, I would like it to show graphics in an environment of its own.
And just to clarify:
This is not a question about "how do I do multithreading/multiprocessing" or even "how do I do multithreading/multiprocessing within a single wxpython gui". The question is how I can start a script from a gui that loads an entirely new gui. How do I get the window manager to see this script as an entirely separate application?
The easiest way would be to generate it in a temporary folder somewhere and then make a non-blocking call to the python interpreter, but this makes communication more difficult and it'd be quite hard to know when I could delete the temp files again. I was hoping there was a cleaner, dynamical way of doing this.
|
How can use Google App Engine with MS-SQL
| 12,116,542
| 0
| 3
| 2,793
| 1
|
python,sql-server,google-app-engine
|
You could, at least in theory, replicate your data from the MS-SQL to the Google Cloud SQL database. It is possible create triggers in the MS-SQL database so that every transaction is reflected on your App Engine application via a REST API you will have to build.
| 0
| 1
| 0
| 0
|
2012-08-24T11:45:00.000
| 2
| 0
| false
| 12,108,816
| 0
| 0
| 1
| 1
|
I use
python 2.7
pyodbc module
google app engine 1.7.1
I can use pydobc with python but the Google App Engine can't load the module. I get a no module named pydobc error.
How can I fix this error or how can use MS-SQL database with my local Google App Engine.
|
Read from windows named pipe with cmd.exe or PowerShell or Python
| 12,110,714
| 0
| 1
| 4,243
| 0
|
python,windows,powershell,command-line,named-pipes
|
The client can connect to a Windows named pipe as if it was any other file, provided it has been created by another program. The low-level API is CreateFile using ALWAYS_EXISTING, but the ordinary language routines, like Python's open should work. The filename will be \\ server \pipe\ name.
Unlike disk files pipes are temporary, and when every handle to a pipe has been closed, the pipe and all the data it contains are deleted, so personally I maintain the pipe using a service where necessary.
| 0
| 1
| 0
| 0
|
2012-08-24T13:26:00.000
| 2
| 0
| false
| 12,110,312
| 1
| 0
| 0
| 1
|
I'm looking for a quick way to check which data comes into a named pipe (on windows). Is there any way to do it from cmd.exe or powershell or python? Actually I found only ways to create named pipe and than manipulate it. But how can I open a named pipe created by another program?
|
Google App Engine HRD Migration - Data Read Returns Nothing
| 12,185,853
| 0
| 0
| 104
| 0
|
google-app-engine,python-2.7
|
The issue has resolved itself after a few days. Now the app is returning the correct data. It may be just a glitch from the migration. I have another GAE app that's stuck in the middle of the migration. Searching on SO I have found others that are experiencing the same problem.
| 0
| 1
| 0
| 0
|
2012-08-24T16:49:00.000
| 1
| 1.2
| true
| 12,113,554
| 0
| 0
| 1
| 1
|
After following the instruction to migrate from a GAE app from Master/Slave to High Replication Datastore(HRD), the app is returning nothing for datastore read. I am able to see the data using the "Datastore Viewer" and they are there (migrated successfully). I have not changed any code. Just wondering if there's anything I need to set or configure for the datastore read to happen. I don't see any error in the "Log Console" on my dev machine and no error on the server's "Logs".
|
CherryPy SSL behind Apache
| 12,114,468
| 2
| 0
| 435
| 0
|
python,ssl,apache2,cherrypy
|
You cannot do that (nor would I try to). Firstly, Apache will be better for terminating the SSL than CherryPy (if for no other reason, than performance). And secondly, it will simply not work because Apache speaks HTTP and HTTPS is actually HTTP encrypted with SSL, so you need to handle the SSL before you get any HTTP that Apache can understand.
| 0
| 1
| 0
| 0
|
2012-08-24T17:42:00.000
| 2
| 0.197375
| false
| 12,114,229
| 0
| 0
| 0
| 2
|
Is there a way to set up CherryPy to use SSL when running behind Apache2 without configuring Apache2 to do SSL for CherryPy?
I have found multiple tutorials about using SSL with CherryPy and configuring Apache2 to do the SSL work for CherryPy, but I have not been able to find a tutorial that deals with using SSL with CherryPy behind Apache2 without configuring Apache2 to do the SSL work.
|
CherryPy SSL behind Apache
| 12,115,325
| 3
| 0
| 435
| 0
|
python,ssl,apache2,cherrypy
|
to expound a bit on gcbrizan's answer, you cannot because the first step required to understand an https request is to first decrypt the connection. SSL/TLS work in two modes; tunneling and STARTTLS; in the latter, a normal connection is started, and at some point, once the two parties have established whatever they want to do with the connection; one peer asks the other to start encrypting the connection. ESMTP (email) uses this mechanism.
HTTP, however, does not have a starttls feature; so tunneling is used instead. Before any http traffic is transferred, both parties start a secure tunnel; the client verifies the correctness of the server's certificate, and the server may do the same for the client (if required/requested). Only once all of this has happened does the client send the page request.
were apache (or any other proxy) to do this, that means that it would have to pass all encrypted traffic to the origin server (cherrypy in your question) since the traffic is encrypted, the proxy has no opportunity to "send this request here, but that request there". If it's just passing all traffic unmodified, then it's not really doing anything helpful at all; and you may as well expose the origin server directly.
| 0
| 1
| 0
| 0
|
2012-08-24T17:42:00.000
| 2
| 1.2
| true
| 12,114,229
| 0
| 0
| 0
| 2
|
Is there a way to set up CherryPy to use SSL when running behind Apache2 without configuring Apache2 to do SSL for CherryPy?
I have found multiple tutorials about using SSL with CherryPy and configuring Apache2 to do the SSL work for CherryPy, but I have not been able to find a tutorial that deals with using SSL with CherryPy behind Apache2 without configuring Apache2 to do the SSL work.
|
How to determine from a python application if X server/X forwarding is running?
| 12,123,998
| 2
| 8
| 8,184
| 0
|
python,ssh,pyqt4,xserver
|
Similar to your xclock solution, I like to run xdpyinfo and see if it returns an error.
| 0
| 1
| 0
| 1
|
2012-08-25T14:05:00.000
| 4
| 0.099668
| false
| 12,122,671
| 0
| 0
| 0
| 2
|
I'm writing a linux application which uses PyQt4 for GUI and which will only be used during remote sessions (ssh -XY / vnc).
So sometimes it may occur that a user will forget to run ssh with X forwarding parameters or X forwarding will be unavailable for some reason. In this case the application crashes badly (unfortunately I am force to use an old C++ library wrapped into python and it completely messes user's current session if the application crashes).
I cannot use something else so my idea is to check if X forwarding is available before loading that library. However I have no idea how to do that.
I usually use xclock to check if my session has X forwarding enabled, but using xclock sounds like a big workaround.
ADDED
If possible I would like to use another way than creating an empty PyQt window and catching an exception.
|
How to determine from a python application if X server/X forwarding is running?
| 12,123,396
| 8
| 8
| 8,184
| 0
|
python,ssh,pyqt4,xserver
|
Check to see that the $DISPLAY environment variable is set - if they didn't use ssh -X, it will be empty (instead of containing something like localhost:10).
| 0
| 1
| 0
| 1
|
2012-08-25T14:05:00.000
| 4
| 1.2
| true
| 12,122,671
| 0
| 0
| 0
| 2
|
I'm writing a linux application which uses PyQt4 for GUI and which will only be used during remote sessions (ssh -XY / vnc).
So sometimes it may occur that a user will forget to run ssh with X forwarding parameters or X forwarding will be unavailable for some reason. In this case the application crashes badly (unfortunately I am force to use an old C++ library wrapped into python and it completely messes user's current session if the application crashes).
I cannot use something else so my idea is to check if X forwarding is available before loading that library. However I have no idea how to do that.
I usually use xclock to check if my session has X forwarding enabled, but using xclock sounds like a big workaround.
ADDED
If possible I would like to use another way than creating an empty PyQt window and catching an exception.
|
why am I getting warning: no files found matching 'MANIFEST', 'ChangeLog', 'GPL when mysql-python installs successfully
| 12,537,780
| 1
| 1
| 1,106
| 0
|
django,virtualenv,mysql-python
|
Those files aren't important for running MySQLdb, but they should be included, and I'll fix this for the next release if possible. (Fixed in the 1.2.4 betas)
| 0
| 1
| 0
| 0
|
2012-08-25T19:10:00.000
| 1
| 1.2
| true
| 12,124,852
| 1
| 0
| 0
| 1
|
When using pip to install mysql-python in virtualenv on ubuntu, the install goes through successfully but with the following warnings:
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
Anyone know why? is it something I need to worry about?
|
What are some choice Python programming environments?
| 12,126,980
| 0
| 0
| 2,952
| 0
|
python,development-environment
|
Don't expect what you'd get from a classical programming language IDE from something having to do with Python. It can't be done due to the dynamic nature of the language and the fact that in order to figure out details such as autocomplete, parameter info or members, an IDE would have, at some point, to run the code - it can't be done because of the possible side-effects.
I'm using Emacs and Sublime Text 2 myself.
| 0
| 1
| 0
| 0
|
2012-08-26T01:15:00.000
| 3
| 0
| false
| 12,126,964
| 1
| 0
| 0
| 1
|
I'm wondering if there's a more beginner-friendly environment to write Python than a terminal shell. Any suggestions?
|
pause system functionality until my python script is done
| 12,134,029
| 2
| 0
| 223
| 0
|
python,linux,passwords
|
You want the equivalent of a "modal" window, but this is not (directly) possible in a multiuser, multitasking environment.
The next best thing is to prevent the user from accessing the system. For example, if you create an invisible window as large as the display, that will intercept any mouse events, and whatever is "behind" will be unaccessible.
At that point you have the problem of preventing the user from using the keyboard to terminate the application, or to switch to another application, or to another virtual console (this last is maybe the most difficult). So you need to access and lock the keyboard, not only the "standard" keyboard but the low-level keys as well.
And to do this, your application needs to have administrative rights, and yet run in the user environment. Which starts to look like a recipe for disaster, unless you really know what you are doing.
What you want to do should be done through a Pluggable Authentication Module (PAM) that will integrate with your display manager. Maybe, you can find some PAM module that will "outsource" or "callback" some external program, i.e., your Python script.
| 0
| 1
| 0
| 1
|
2012-08-26T20:57:00.000
| 3
| 0.132549
| false
| 12,133,857
| 0
| 0
| 0
| 2
|
I have written a simple python script that runs as soon as a certain user on my linux system logs in. It ask's for a password... however the problem is they just exit out of the terminal or minimize it and continue using the computer. So basically it is a password authentication script. So what I am curious about is how to make the python script stay up and not let them exit or do anything else until they entered the correct password. Is there some module I need to import or some command that can pause the system functions until my python script is done?
Thanks
I am doing it just out of interest and I know a lot could go wrong but I think it would be a fun thing to do. It can even protect 1 specific system process. I am just curious how to pause the system and make the user do the python script before anything else.
|
pause system functionality until my python script is done
| 12,134,000
| 3
| 0
| 223
| 0
|
python,linux,passwords
|
There will always be a way for the user to get past your script.
Let's assume for a moment that you actually manage to block the X-server, without blocking input to your program (so the user can still enter the password). The user could just alt-f1 out of the X-server to a console and kill "your weird app". If you manage to block that too he could ssh to the box and kill your app.
There is most certainly no generic way to do something like this; this is what the login commands for the console and the session managers (like gdm) for the graphical display are for: they require a user to enter his password before giving him some form of interactive session. After that, why would you want yet another password to do the same thing? the system is designed to not let users use it without a password (or another form of authentication), but there is no API to let programs block the system whenever they feel like it.
| 0
| 1
| 0
| 1
|
2012-08-26T20:57:00.000
| 3
| 0.197375
| false
| 12,133,857
| 0
| 0
| 0
| 2
|
I have written a simple python script that runs as soon as a certain user on my linux system logs in. It ask's for a password... however the problem is they just exit out of the terminal or minimize it and continue using the computer. So basically it is a password authentication script. So what I am curious about is how to make the python script stay up and not let them exit or do anything else until they entered the correct password. Is there some module I need to import or some command that can pause the system functions until my python script is done?
Thanks
I am doing it just out of interest and I know a lot could go wrong but I think it would be a fun thing to do. It can even protect 1 specific system process. I am just curious how to pause the system and make the user do the python script before anything else.
|
Communicating with bash scripts from python
| 12,141,142
| 1
| 0
| 479
| 0
|
python,windows,bash,mingw
|
Sure you can communicate between them, just read/write from a file or pair of files (one for Python to write to and the bash script to read from, and the other for the visa-versa situation).
| 0
| 1
| 0
| 1
|
2012-08-27T10:52:00.000
| 2
| 1.2
| true
| 12,140,608
| 0
| 0
| 0
| 1
|
I am running some shell test scripts from a python script under Windows. The shell scripts are testing the functionality of various modules.
The problem that I faced is that some scripts can hang. For this I added a timeout for each script. This timeout has a default value. But this timeout value can be changed by the bash script - from a bash function ( SetMaxTime ) - I can modify SetMaxTime.
When the default value is used I wait for that period of time in python and if the bash script is not done I will consider that test as failed due to timeout.
The problem is when the default value of timeout is changed from bash. Is there a way to communicate with a bash script (ran with mingw) from python?
NOTE: The scripts are ran under Windows.
|
is snmp required
| 12,147,545
| 1
| 0
| 197
| 0
|
python,monitoring,snmp
|
The SNMP is a standard monitoring (and configuration) tool used widely in managing network devices (but not only). I don't understand your question fully - is it a problem that you cannot use SNMP because device does not support it (what does it support then?) To script anything you have to know what interface is exposed to you (if not a MIB files then what?). Did you read about NETCONF?
| 0
| 1
| 1
| 0
|
2012-08-27T18:11:00.000
| 2
| 1.2
| true
| 12,147,224
| 0
| 0
| 0
| 2
|
is snmp really required to manage devices ?
i'd like to script something with python to manage devices (mainly servers), such as disk usage, process list etc.
i'm learning how to do and many article speak about snmp protocole.
I can't use, for example, psutil, or subprocess or os modules, and send information via udp ?
Thanks a lot
|
is snmp required
| 12,148,746
| 1
| 0
| 197
| 0
|
python,monitoring,snmp
|
No, it's not required, but your question is sort of like asking if you're required to use http to serve web pages. Technically you don't need it, but if you don't use it you're giving up interoperability with a lot of existing client software.
| 0
| 1
| 1
| 0
|
2012-08-27T18:11:00.000
| 2
| 0.099668
| false
| 12,147,224
| 0
| 0
| 0
| 2
|
is snmp really required to manage devices ?
i'd like to script something with python to manage devices (mainly servers), such as disk usage, process list etc.
i'm learning how to do and many article speak about snmp protocole.
I can't use, for example, psutil, or subprocess or os modules, and send information via udp ?
Thanks a lot
|
Kill a background program from another program
| 12,150,416
| 3
| 1
| 121
| 0
|
python,linux,background
|
You can use Python's os.kill to kill a process by its pid, sending a mostly-arbitrary signal to it like SIGTERM or SIGINT. If it won't die, try SIGKILL.
You can look up a process' pid using the pidof program, or if you use subprocess.Popen you can get the pid from the popen object without needing to spawn another subprogram. os.system is no longer in great favor, at least not compared to subprocess.Popen.
| 0
| 1
| 0
| 0
|
2012-08-27T22:09:00.000
| 1
| 1.2
| true
| 12,150,321
| 0
| 0
| 0
| 1
|
So I'm running a python script:
It starts a logging program in the background
Does a bunch of stuff.
Then stops the logging program.
So I have two questions:
1) I understand to run a background program, I could call:
os.system("test_log_prog &")
but can I also do:
os.system("test_echo_prog > logfile.log &")
or something equivalent?
2) How can I close test_echo_prog?
for the program, I was using pkill "test_log_prog" but for some reason it doesn't work when using > logfile.log.....
Thanks in advance!
Cheers!
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.