Available Count
int64 1
31
| AnswerCount
int64 1
35
| GUI and Desktop Applications
int64 0
1
| Users Score
int64 -17
588
| Q_Score
int64 0
6.79k
| Python Basics and Environment
int64 0
1
| Score
float64 -1
1.2
| Networking and APIs
int64 0
1
| Question
stringlengths 15
7.24k
| Database and SQL
int64 0
1
| Tags
stringlengths 6
76
| CreationDate
stringlengths 23
23
| System Administration and DevOps
int64 0
1
| Q_Id
int64 469
38.2M
| Answer
stringlengths 15
7k
| Data Science and Machine Learning
int64 0
1
| ViewCount
int64 13
1.88M
| is_accepted
bool 2
classes | Web Development
int64 0
1
| Other
int64 1
1
| Title
stringlengths 15
142
| A_Id
int64 518
72.2M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 1 | 0 | 2 | 2 | 0 | 1.2 | 0 |
Well, I have created a python script, which checks the number of uncompleted tasks of tasque and displays it using pynotify periodically. My question is how do I implement this timer. I can think of two things. A Cron job to execute a python script periodically or using a python script which uses a gtk loop to call the specified function for checking periodically.
| 0 |
python
|
2010-11-24T15:19:00.000
| 1 | 4,268,374 |
Cron job. It's more likely to be "in line" with actual time, since it's a more stable and time-tested choice. It's also less demanding on resources than using a loop in Python since it doesn't require a constant Python interpreter process, and is probably better optimized than pyGTK (choice is mature, stable software vs. less mature, less stable).
| 0 | 383 | true | 0 | 1 |
Gtk loop or Cron for timer
| 4,268,840 |
1 | 1 | 1 | 1 | 20 | 0 | 0.197375 | 0 |
I need to expose a file-like object from a C library that i'm wrapping with a Cython module. I want to reuse python's generic io code for stuff like buffering, readline(), etc.
The new IO module seems to be just what i need, but actually using it from Cython seems to be non-trivial, I've tried several aproaches:
My code in a cdef class that inherits from IO.RawIOBase - This fails because cdef classes can inherit only from other cython cdef classes, while IO is "raw" C.
My code in a cdef class, another (non-cdef) class that inherits both my cdef class and RawIOBase - Fails with "TypeError: multiple bases have instance lay-out conflict"
My code in a (non-cdef) class that inherits from RawIOBase - This works, but i loose the ability to store my c-level (that i need to talk to the underlying library) stuff inside the class, so i need a make a cdef wrapper around it and store that as a member... this looks like a mess.
My code in cdef class that doesn't inherit (Raw)IOBase rather reimplements it's functionality, Python code gets my object wrapped in BufferedReader/BufferedWriter - This one seems to work and less messy than the previous option.
My questions(s):
1) Am I missing something and reinventing the wheel here?
2) What is the exact stuff from IOBase that I need to implement to keep BufferedReader/Writer happy with my object in current and future versions of python? Is this documented anywhere?
3) How will that work in python 2.6 where IO is pure python? I guess that performance will suffer but it will work, right?
| 0 |
python,file-io,cython
|
2010-11-25T15:08:00.000
| 0 | 4,278,444 |
Would it be too inefficient to call os.fdopen() on the file descriptor number returned by the underlying library, and then to dispatch normal Python method calls to the resulting file object in order to do your input and output? With most I/O, I would be surprised if you could see a difference with whether you called a C routine directly or let the Python method dispatch logic call it for you — but, of course, you might be in an unusual situation and I could be wrong!
| 0 | 1,145 | false | 0 | 1 |
Exposing a file-like object from Cython
| 8,262,264 |
1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
Importing M2Crypto version 0.20.2 on python 2.6.5 fails when M2Crypto was compiled against a recent openssl versions (0.9.8x or higher) on MAC OS X 10.4.11:
Even though the compilation works against these openssl version, M2Crypto fails to import, because a missing symbol: _PEM_read_bio_EC_PUBKEY
Python 2.6.5 (r265:79359, Mar 24 2010, 01:32:55)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import M2Crypto
Traceback (most recent call last):
File "", line 1, in
File "M2Crypto/init.py", line 22, in
import _m2crypto
ImportError: dlopen(M2Crypto/_m2crypto.so, 2): Symbol not found: _PEM_read_bio_EC_PUBKEY
Referenced from: M2Crypto/__m2crypto.so
Expected in: dynamic lookup
If I compile M2Crypto against openssl version 0.9.7l or 0.9.7m it works just fine.
Any suggestion?
| 0 |
python,openssl,m2crypto
|
2010-11-25T21:13:00.000
| 0 | 4,280,885 |
I don't have 10.4.11, but I do have 10.5.8 with Python 2.6.5 and OpenSSL 0.9.8n and everything works without a problem. Please try with latest M2Crypto. If that does not work, try getting and compiling OpenSSL yourself and configuring M2Crypto to use that. Maybe something is wrong with your current OpenSSL.
| 0 | 257 | false | 0 | 1 |
Symbol not found: _PEM_read_bio_EC_PUBKEY Importing M2Crypto-0.20.2 when compiled against openssl 0.9.8x or 1.0.0x
| 5,480,356 |
1 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
Is it possible to configure PyCharm in the following way:
Request auto-completion on any letter key press
Complete on space press, instead of enter
Request completion for modules not in path
I mean, configure it in VS-way.
Also, VS-like hotkeys will be amazing option
| 0 |
python,pycharm
|
2010-11-25T22:13:00.000
| 0 | 4,281,190 |
Not a pro on this but I think you have to use the module name preceding the method you want to call. For example to call a function named doStuff in the settings module call settings.doStuff().
To call the methods directly you need to use "from settings import *". But I think this method is frowned upon.
| 0 | 1,813 | false | 0 | 1 |
PyCharm imports and code completion
| 4,281,235 |
2 | 8 | 0 | 27 | 42 | 0 | 1.2 | 1 |
I need to have a python client that can discover queues on a restarted RabbitMQ server exchange, and then start up a clients to resume consuming messages from each queue. How can I discover queues from some RabbitMQ compatible python api/library?
| 0 |
python,rabbitmq,amqp
|
2010-11-26T19:06:00.000
| 0 | 4,287,941 |
As far as I know, there isn't any way of doing this. That's nothing to do with Python, but because AMQP doesn't define any method of queue discovery.
In any case, in AMQP it's clients (consumers) that declare queues: publishers publish messages to an exchange with a routing key, and consumers determine which queues those routing keys go to. So it does not make sense to talk about queues in the absence of consumers.
| 0 | 70,261 | true | 0 | 1 |
How can I list or discover queues on a RabbitMQ exchange using python?
| 4,288,304 |
2 | 8 | 0 | 2 | 42 | 0 | 0.049958 | 1 |
I need to have a python client that can discover queues on a restarted RabbitMQ server exchange, and then start up a clients to resume consuming messages from each queue. How can I discover queues from some RabbitMQ compatible python api/library?
| 0 |
python,rabbitmq,amqp
|
2010-11-26T19:06:00.000
| 0 | 4,287,941 |
Management features are due in a future version of AMQP. So for now you will have to wait till for a new version that will come with that functionality.
| 0 | 70,261 | false | 0 | 1 |
How can I list or discover queues on a RabbitMQ exchange using python?
| 4,289,172 |
1 | 1 | 0 | 0 | 0 | 0 | 1.2 | 1 |
My code was working correctly till yesterday and I was able to fetch tweets, from GetSearch(), but now it is returning empty list, though I check my credentials are correct
Is something changed recently??
Thank you
| 0 |
python-twitter
|
2010-11-27T11:08:00.000
| 0 | 4,291,319 |
They might have a limit of requests in a certain amount of time or they had a failure on the system. You can ask for new credentials to see if the problem was the first one and try getting the tweets with them.
| 0 | 297 | true | 0 | 1 |
python-twitter GetSearch giving empty list
| 4,291,535 |
5 | 6 | 0 | 2 | 1 | 0 | 0.066568 | 0 |
I have been working as a web dev with C#, VB and PHP (now learning python)..
I have been considering learning C (as a right of passage) because i hate feeling stupid =P
Apart from making me a better programmer in general..
Is there any particualr use to C for a Web Dev in 2010?
Thanks,
Daniel
| 0 |
c#,python,c
|
2010-11-27T11:30:00.000
| 0 | 4,291,401 |
You always need to know enough c to port headers to your language of choice when there are no ports for a library you want to use yet. Many libraries are written in c since then they can be used from almost all platforms/languages.
| 0 | 241 | false | 0 | 1 |
Is there any merit to a web developer learning C?
| 4,291,519 |
5 | 6 | 0 | 0 | 1 | 0 | 0 | 0 |
I have been working as a web dev with C#, VB and PHP (now learning python)..
I have been considering learning C (as a right of passage) because i hate feeling stupid =P
Apart from making me a better programmer in general..
Is there any particualr use to C for a Web Dev in 2010?
Thanks,
Daniel
| 0 |
c#,python,c
|
2010-11-27T11:30:00.000
| 0 | 4,291,401 |
no :)
C is not targeted for web development
| 0 | 241 | false | 0 | 1 |
Is there any merit to a web developer learning C?
| 4,291,408 |
5 | 6 | 0 | 2 | 1 | 0 | 0.066568 | 0 |
I have been working as a web dev with C#, VB and PHP (now learning python)..
I have been considering learning C (as a right of passage) because i hate feeling stupid =P
Apart from making me a better programmer in general..
Is there any particualr use to C for a Web Dev in 2010?
Thanks,
Daniel
| 0 |
c#,python,c
|
2010-11-27T11:30:00.000
| 0 | 4,291,401 |
Learning C won't necessarily make you a better programmer; there's a superstition that because C is moderately difficult to learn (true) and doesn't have an extensive toolkit (also true), you gain a deeper insight into programming in general (not necessarily true). C's just another language, no better or worse than any other. You'd get as much benefit learning Fortran. If you're really interested in how things work at the machine/OS level, you'd be better served learning an assembler; just remember that assemblers are specific to their platforms, and some of the concepts that apply to x86 don't apply to other platforms such as MIPS or PPC.
Learning C won't help you much in your day-to-day work in web development.
Having said that, it's always a good idea to pick up new languages if you can, especially languages that are as different as possible from what you're currently using, just because it helps you to learn the difference between a general programming concept vs. a particular language's implementation of that concept. I've seen plenty of people proficient in a language like C# flail helplessly when forced to work in C because all of their shiny tools are missing.
| 0 | 241 | false | 0 | 1 |
Is there any merit to a web developer learning C?
| 4,293,283 |
5 | 6 | 0 | 1 | 1 | 0 | 0.033321 | 0 |
I have been working as a web dev with C#, VB and PHP (now learning python)..
I have been considering learning C (as a right of passage) because i hate feeling stupid =P
Apart from making me a better programmer in general..
Is there any particualr use to C for a Web Dev in 2010?
Thanks,
Daniel
| 0 |
c#,python,c
|
2010-11-27T11:30:00.000
| 0 | 4,291,401 |
Given that you have experience of object orientated programming in C#, I would recommend learning C++ as opposed to C. It will indeed make you a more rounded programmer. While you could program web sites using C or C++, it's not commonly done for small scale web sites. Facebook created HipHop for PHP for instance to improve performance:
HipHop programmatically transforms your PHP source code into highly optimized C++ and then uses g++ to compile it.
Good luck with your learning, never stop :-)
| 0 | 241 | false | 0 | 1 |
Is there any merit to a web developer learning C?
| 4,292,028 |
5 | 6 | 0 | 4 | 1 | 0 | 0.132549 | 0 |
I have been working as a web dev with C#, VB and PHP (now learning python)..
I have been considering learning C (as a right of passage) because i hate feeling stupid =P
Apart from making me a better programmer in general..
Is there any particualr use to C for a Web Dev in 2010?
Thanks,
Daniel
| 0 |
c#,python,c
|
2010-11-27T11:30:00.000
| 0 | 4,291,401 |
Learning C (or, for the added fun, C++) as a device of increasing your understanding of programming is a good idea IMHO. But it doesn't have anything to offer you as regards web development.
| 0 | 241 | false | 0 | 1 |
Is there any merit to a web developer learning C?
| 4,291,457 |
2 | 5 | 0 | 1 | 2 | 1 | 1.2 | 0 |
I currently have Python 2.6.2 installed on my mac. I am writing a script which MUST run on Python 2.5.2. So I want to write a python script, and test is specifically against 2.5.2 and NOT 2.6.2.
I was looking at virtualenv, but it doesn't seem to solve my problem. I ran python virtualenv.py TEST which made a TEST dir, but it had python 2.6 in it. Is there a way to make virtualenv use a different version of python than what's installed default on my machine? Is another way to use the #! as the first line of the python script? How would I do that?
| 0 |
python,tox
|
2010-11-29T07:27:00.000
| 0 | 4,301,681 |
You could just install a Python 2.5.2.
I have 3 different versions Python installed on my Lucid and they use different links under /bin/ so it's easy to call the specific version
python -> python3 ->python3.1
python2 -> python2.7
python2.5
| 0 | 4,321 | true | 0 | 1 |
Testing a python script in a specific version
| 4,301,739 |
2 | 5 | 0 | 0 | 2 | 1 | 0 | 0 |
I currently have Python 2.6.2 installed on my mac. I am writing a script which MUST run on Python 2.5.2. So I want to write a python script, and test is specifically against 2.5.2 and NOT 2.6.2.
I was looking at virtualenv, but it doesn't seem to solve my problem. I ran python virtualenv.py TEST which made a TEST dir, but it had python 2.6 in it. Is there a way to make virtualenv use a different version of python than what's installed default on my machine? Is another way to use the #! as the first line of the python script? How would I do that?
| 0 |
python,tox
|
2010-11-29T07:27:00.000
| 0 | 4,301,681 |
try #!/path/to/your/python/version
But make sure you execute the script from the terminal, and make it executable before hand: chmod 755 myscript.py
| 0 | 4,321 | false | 0 | 1 |
Testing a python script in a specific version
| 4,301,698 |
1 | 4 | 0 | 0 | 1 | 0 | 0 | 0 |
I have a Python application (command line tool running on a machine M1) that has input I1 and output O2. Also, I have a PHP application (website running on a machine M2) that feeds the Python application with input I1 and expects to read the output O1. My question is what's the best approach to solve this problem? (the environment is GNU/Linux)
I was thinking at a solution with ssh; the PHP script executes a command via ssh: "ssh M2:./my_script.py arguments output_file" and transfers the output file "scp M2:output_file ." from M2 to M1. But, I don't think this solution is elegant. I was thinking of web services (the Python application should expose a web service), but I'm not sure what's the complexity of this solution or if it works.
Thanks,
| 0 |
php,python
|
2010-11-29T15:16:00.000
| 1 | 4,305,070 |
I think you should implement a web service . I don't know how to do it with python but i suppose it would be fairly easy.
| 0 | 354 | false | 0 | 1 |
PHP and Python interfacing
| 4,305,158 |
1 | 2 | 0 | 1 | 1 | 0 | 0.099668 | 0 |
We use Hudson-CI for out Continuous Integration server for Python projects, all of which use Buildout to manage dependencies. Almost all our projects use lxml which, because of Buildout, must be built/installed during each test-run and because it takes so long it reduces the number of builds we can run per day.
Is there any way to speed-up the build of lxml when using Buildout? Maybe some environment variables can be set to help the build use both cores on the server? Or something to reduce the amount of optimization done?
| 0 |
python,compilation,lxml
|
2010-11-30T12:33:00.000
| 0 | 4,313,782 |
My solution is to create an egg myself and keep that egg version-controlled with my buildout. I recreate the egg each time I need to upgrade lxml. You can almost always create a binary egg of any Python project by throwing an import setuptools into the top of its setup.py and then saying python setup.py bdist_egg. And as long as the machines you install the egg on are roughly similar binary-wise (such as all being the same Linux distro), you should not have a terrible lot of trouble. Read up on building lxml with "static deps", as the call them, if you want your egg to not depend on libxml being installed on the box.
| 0 | 962 | false | 0 | 1 |
How can I speed-up the build/install of lxml?
| 4,327,797 |
1 | 2 | 0 | 3 | 1 | 0 | 0.291313 | 0 |
I want to send messages through the serial port using PySerial. One of the parameters for the serial constructor is 'bytesize'. I have been trying serial.SEVENBITS and serial.EIGHTBITS and haven't noticed a difference. The documentation is a bit vague and I am new to both Python and serial communication.
Does this just set the maximum value a byte can hold or is it something to do with signed bytes? Can anyone clear up why I'd use 7 bits over 8?
I have been searching but haven't found an answer.
Thank you
| 0 |
python,size,byte,pyserial
|
2010-12-01T19:25:00.000
| 0 | 4,328,223 |
Historically, it was common to only send ASCII text over a serial connection, which fit into seven bits, and an eighth bit would be used as a parity marker which could indicate if the data was being transmitted correctly.
Since the parity check doesn't catch errors on an even number of bits, and can't correct the data at all, it's not that valuable, and modern practice is to use 8-bit data and do error detection and correction at a higher layer of protocol.
Short answer is you probably want 8-bit, but it depends on what the other end of the serial connection is expecting.
Update:
From your other question it sounds like you're programming both ends of the connection, and checksumming your messages, so it's definitely most straightforward to use 8-bit.
| 0 | 4,981 | false | 0 | 1 |
'bytesize' in PySerial module
| 4,328,281 |
1 | 2 | 0 | 0 | 0 | 1 | 0 | 0 |
So I have a big project with many modules in it, and I want to run some profiling on it. I have a profile module that basically just provides a decorator that I can add to a function to profile it when it's called.
The problem is, I'll have to import that module into the dozens of modules that I have. This is fine I guess, but I can't push the code with the profiling modules imported or the decorator on the functions to version control. This means every time I import/export, I have to add/remove all my profiling code.
Is there any kind of system to manage this adding/removing of profiling code without manually importing/deleting the modules in every module of my project? We use mercurial, but I can't really mess with mercurial settings or make a branch.
| 0 |
python,module,profiling
|
2010-12-01T20:18:00.000
| 0 | 4,328,681 |
Why not just create a branch with all the profiling changes, and then merge the branch when you want to test ... and revert everything afterwards.
git makes this somewhat easier with it's "git stash", but using branches shouldn't be significantly harder.
| 0 | 516 | false | 0 | 1 |
python module import question
| 4,328,745 |
1 | 2 | 0 | 0 | 0 | 0 | 1.2 | 0 |
I met a problem while using python(2.6) cgi to show a mime data in windows(apache).
For example, to show a image, here is my code:
image.py
#!E:/program files/Python26/python.exe
# -*- coding: UTF-8 -*-
data = open('logo.png','rb').read()
print 'Content-Type:image/png;Content-Disposition:attachment;filename=logo.png\n'
print data
But it dose not work in windows(xp or 7)+apache or IIS.
(I try to write these code in diferent way, and also try other file format, jpg and rar, but no correct output, the output data seems to be disorder in the begining lines.)
And I test these code in linux+apache, and it is Ok!
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
data = open('logo.png','rb').read()
print 'Content-Type:image/png;Content-Disposition:attachment;filename=logo.png\n'
print data
I just feel confused why it does not work in windows.
Could anybody give me some help and advice?
| 0 |
python,windows,apache,cgi,mime
|
2010-12-02T06:26:00.000
| 1 | 4,332,293 |
Now I know how to solve this problem:
For windows+IIS:
While adding the application mapping(IIS), write C:\Python20\python.exe -u %s %s. I used to write like this c:\Python26\python.exe %s %s, that will create wrong mime data. And "-u" means unbuffered binary stdout and stderr.
For windows+Apache:
Add #!E:/program files/Python26/python.exe -u to the first line of the python script.
Thank Ignacio Vazquez-Abrams all the same!
| 0 | 381 | true | 1 | 1 |
how to show mime data using python cgi in windows+apache
| 5,335,384 |
8 | 12 | 0 | 4 | 29 | 1 | 0.066568 | 0 |
I have an affinity for python, but I work in a .NET environment, so I was looking into Iron Python, and wondering what it would be used for.
Could you write an app in it? or is it for adding a scripting language to your app?
How do you guys use it?
| 0 |
.net,python,ironpython,dynamic-language-runtime
|
2010-12-02T14:47:00.000
| 0 | 4,336,228 |
I think the Iron family of languages is primarily for adding more flavours to the platform, allowing you to get into .NET using a language that you are familiar with. It lowers the bar a lot for getting new people with different backgrounds into .NET
Even though the syntax is Python, the implementation is still built on top of the CLR and the end product will not differ a lot if you decide to go for an IronPython project instead of say C#.
I've had some experience with IronPython and find it nice to work with (it helps of course that I really like the language). IronPython is now considered a first class citizen by Microsoft, and that is also the impression you get when using it. One downside to using it though is that it isn't as widely adopted as the two main languages, causing some issues when it comes to collaboration and maintaining a code base over time.
I found it particularly useful when doing a .NET port of a search algorithm that was first implemented in Python.
Regarding adding scripting abilities to your app, that is probably not the original intention with IronPython, but it has been done. The Umbraco CMS has (or at least had) the ability to create widgets using Python as a dynamic scripting language within their platform. A pretty neat feature to have.
You should go ahead and try it out.. It's always good to have more tools in the belt :)
| 0 | 19,054 | false | 0 | 1 |
Iron Python : what are good uses for Iron Python
| 4,336,338 |
8 | 12 | 0 | 1 | 29 | 1 | 0.016665 | 0 |
I have an affinity for python, but I work in a .NET environment, so I was looking into Iron Python, and wondering what it would be used for.
Could you write an app in it? or is it for adding a scripting language to your app?
How do you guys use it?
| 0 |
.net,python,ironpython,dynamic-language-runtime
|
2010-12-02T14:47:00.000
| 0 | 4,336,228 |
You can write an app in it, you can use it as a scripting language in your app.
It's used for accessing existing Python libraries and, if needed, writing parts of your code in Python if a .NET languages doesn't seem well enough suited for that job.
| 0 | 19,054 | false | 0 | 1 |
Iron Python : what are good uses for Iron Python
| 4,336,257 |
8 | 12 | 0 | 4 | 29 | 1 | 0.066568 | 0 |
I have an affinity for python, but I work in a .NET environment, so I was looking into Iron Python, and wondering what it would be used for.
Could you write an app in it? or is it for adding a scripting language to your app?
How do you guys use it?
| 0 |
.net,python,ironpython,dynamic-language-runtime
|
2010-12-02T14:47:00.000
| 0 | 4,336,228 |
We use it as an embedded language inside of our software.
I had an article on my blog, but recently switched to a new system. You can find an archived version (with broken image links) here:
Our field engineers now use the embedded language to test things on the fly,
our quality assurance people use it to create small scripts to test all features of the hardware, etc....
Hope this helps.
| 0 | 19,054 | false | 0 | 1 |
Iron Python : what are good uses for Iron Python
| 4,336,253 |
8 | 12 | 0 | 2 | 29 | 1 | 0.033321 | 0 |
I have an affinity for python, but I work in a .NET environment, so I was looking into Iron Python, and wondering what it would be used for.
Could you write an app in it? or is it for adding a scripting language to your app?
How do you guys use it?
| 0 |
.net,python,ironpython,dynamic-language-runtime
|
2010-12-02T14:47:00.000
| 0 | 4,336,228 |
My experience of IronPython is usage it as part of engine that can be changed after installation of base .Net application.
With help of Python we have described really large set of business rules, that can be changed from two system installation. Partially IronPython was used as plugin language.
The difference from script language - that after compilation IronPython executed as CLR code.
| 0 | 19,054 | false | 0 | 1 |
Iron Python : what are good uses for Iron Python
| 4,336,268 |
8 | 12 | 0 | 31 | 29 | 1 | 1.2 | 0 |
I have an affinity for python, but I work in a .NET environment, so I was looking into Iron Python, and wondering what it would be used for.
Could you write an app in it? or is it for adding a scripting language to your app?
How do you guys use it?
| 0 |
.net,python,ironpython,dynamic-language-runtime
|
2010-12-02T14:47:00.000
| 0 | 4,336,228 |
Either or both :)
I wouldn't claim to know a specific "purpose" for IronPython but it certainly can be used to write applications, and it can be used for scripting within a larger .NET application.
Aside from anything else, it's a handy way of gently easing Python developers into the world of .NET. (Why not learn C# at the same time? Come on in, the water's lovely...)
| 0 | 19,054 | true | 0 | 1 |
Iron Python : what are good uses for Iron Python
| 4,336,244 |
8 | 12 | 0 | 2 | 29 | 1 | 0.033321 | 0 |
I have an affinity for python, but I work in a .NET environment, so I was looking into Iron Python, and wondering what it would be used for.
Could you write an app in it? or is it for adding a scripting language to your app?
How do you guys use it?
| 0 |
.net,python,ironpython,dynamic-language-runtime
|
2010-12-02T14:47:00.000
| 0 | 4,336,228 |
You use it to write Python code that runs on the .NET platform. It's good for anything that Python is good for.
The Python language is the Python language, no matter what. IronPython is an implementation of the runtime for that language - the support code that compiles your source, creates a virtual machine to execute the bytecode in the resulting .pyc file, communicates with the OS in order to put command line arguments into sys.argv, and all that other fun stuff. (Well, OK, the .NET platform itself does a lot of the work, too. :) )
| 0 | 19,054 | false | 0 | 1 |
Iron Python : what are good uses for Iron Python
| 4,336,262 |
8 | 12 | 0 | 6 | 29 | 1 | 1 | 0 |
I have an affinity for python, but I work in a .NET environment, so I was looking into Iron Python, and wondering what it would be used for.
Could you write an app in it? or is it for adding a scripting language to your app?
How do you guys use it?
| 0 |
.net,python,ironpython,dynamic-language-runtime
|
2010-12-02T14:47:00.000
| 0 | 4,336,228 |
IronPython is just Yet Another Python Implementation. You can use it anywhere you would use any other Python implementation. (Modulo platform constraints, of course – obviously you can't use IronPython on a Java-only device.)
IronPython is just Yet Another .NET Compiler. You can use it anywhere you would use any other .NET language.
IronPython is More Than Just Yet Another Python Implementation. It's a Python implementation that gives you full access to any .NET library.
IronPython is More Than Just Yet Another .NET Compiler. It's a .NET compiler that gives you full access to any Python library.
IronPython is an embeddable scripting engine for any .NET app, library and framework.
| 0 | 19,054 | false | 0 | 1 |
Iron Python : what are good uses for Iron Python
| 4,336,304 |
8 | 12 | 0 | 1 | 29 | 1 | 0.016665 | 0 |
I have an affinity for python, but I work in a .NET environment, so I was looking into Iron Python, and wondering what it would be used for.
Could you write an app in it? or is it for adding a scripting language to your app?
How do you guys use it?
| 0 |
.net,python,ironpython,dynamic-language-runtime
|
2010-12-02T14:47:00.000
| 0 | 4,336,228 |
You can use it for cool things like having an embedded web server within your application which can be developed with one of the available Python web frameworks. It is much easier and smoother to develop for than hosting an ASP.NET web server within your application. CherryPy for example comes with a builtin web server as well that should work fine with IronPython with a few small modifications.
| 0 | 19,054 | false | 0 | 1 |
Iron Python : what are good uses for Iron Python
| 4,358,367 |
5 | 5 | 0 | 9 | 13 | 1 | 1 | 0 |
What are the differences between a systems programming language and Application programming language?
| 0 |
c#,java,python,perl,programming-languages
|
2010-12-03T06:23:00.000
| 1 | 4,343,014 |
As with a great many things in IT, the line is blurry. For example, C started its life as a systems programming language (and was used to implement Unix), but was and is used for applications development too.
Having said that, there are clearly some languages better suited to systems programming than others (eg. C/C++ are better suited than COBOL/FORTRAN for systems programming). Likewise there are languages that are better suited to applications development and not systems programming eg. VB.NET.
The language features that stand out from the examples above, are the low level features of the systems programming languages like C/C++ (eg. pointers, bit manipulation operators, etc). There is of course the old joke that C is a "Sea" level language (sitting somewhere between the assembly level and the "high" level).
Warning: I'm coming at systems programming from the perspective of OS developer / OS tool developer.
I think it is fair to say, notwithstanding the projects to develop OSes with Java (though I believe mostly are native compiled, rather than to byte code and JIT'ed / interpreted), that systems programming languages target native machine code of their target platforms. So languages that primarily target managed code / interpreted code are less likely to be used for systems programming.
Anyway, that is surely enough to stir up some comments both in support and in opposition :)
| 0 | 13,401 | false | 0 | 1 |
Difference between Systems programming language and Application programming languages
| 4,343,035 |
5 | 5 | 0 | 16 | 13 | 1 | 1.2 | 0 |
What are the differences between a systems programming language and Application programming language?
| 0 |
c#,java,python,perl,programming-languages
|
2010-12-03T06:23:00.000
| 1 | 4,343,014 |
A few factors should in my opinon come into consideration
In a system programming language you must be able to reach low-level stuff, getting close to the real hardware world. In an application language instead there is a sort of "virtual world" (hopefully nicer and easier to interact with) that has been designed with the language and you only need to be able to cope with that.
In a system programming language there should be no concession in terms of performance. One must be able to write code that squeezes out all the juice from the hardware. This is not the biggest concern in an application programming language, where the time needed to actually write the program plays instead a greater role.
Because of 2 a system programming language is free to assume that the programmer makes no mistake and so there will be no "runtime error" guards. For example indexing out of an array is going to mean the end of the world unless the hardware gives those checks for free (but in that case you could probably choose less expensive or faster hardware instead). The idea is that if you assume that the code is correct there is no point in paying even a small price for checking the impossible. Also a system programming language shouldn't get into the way trying to forbid the programmer doing something s/he wants to do intentionally... the assumption is that s/he knows that is the right thing to do. In an application programming language instead it's considered good helping the programmer with checking code and also trying to force the code to use certain philosophical schemas. In application programming languages things like execution speed, typing time and code size can be sacrificed trying to help programmers avoiding shooting themselves.
Because of 3 a system programming language will be much harder to learn by experimentation. In a sense they're sort of powerful but dangerous tools that one should use carefully thinking to every single statement and for the same reason they're languages where debugging is much harder. In application programming languages instead the try-and-see approach may be reasonable (if the virtual world abstraction is not leaking too much) and letting errors in to remove them later is considered a viable option.
| 0 | 13,401 | true | 0 | 1 |
Difference between Systems programming language and Application programming languages
| 4,343,639 |
5 | 5 | 0 | 5 | 13 | 1 | 0.197375 | 0 |
What are the differences between a systems programming language and Application programming language?
| 0 |
c#,java,python,perl,programming-languages
|
2010-12-03T06:23:00.000
| 1 | 4,343,014 |
These are not exact concepts, but in essence, systems programming languages are suitable for writing operating systems (so they have low-level concepts such as pointers, integration with assembler, data types corresponding to memory and register organization), while the application programming languages are more suitable for writing applications, so they generally use higher-level concepts to represent the computation (such as OOP, closures, in-built complex datatypes and so on).
| 0 | 13,401 | false | 0 | 1 |
Difference between Systems programming language and Application programming languages
| 4,343,077 |
5 | 5 | 0 | 2 | 13 | 1 | 0.07983 | 0 |
What are the differences between a systems programming language and Application programming language?
| 0 |
c#,java,python,perl,programming-languages
|
2010-12-03T06:23:00.000
| 1 | 4,343,014 |
In general, a systems programming language is lower level than applications programming languages. However, the language itself has nothing to do with it.. it's more the particulars of the implementation of the language.
For example, Pascal started life as a teaching language, and was pretty much strictly applications.. however, it was evolved into a systems language and was used to create early versions of MacOS and Windows.
C# is not, typically a systems language because it cannot do low-level work, although even that line is blurred as managed operating systems come into being.
| 0 | 13,401 | false | 0 | 1 |
Difference between Systems programming language and Application programming languages
| 4,343,085 |
5 | 5 | 0 | 2 | 13 | 1 | 0.07983 | 0 |
What are the differences between a systems programming language and Application programming language?
| 0 |
c#,java,python,perl,programming-languages
|
2010-12-03T06:23:00.000
| 1 | 4,343,014 |
i don't think there is a final answer here anymore.
perl and python come by default with almost every linux distro...both can inline C...both can do job control and other "low level" tasks...threading etc.
any language with a good set of system call bindings and/or FFI should be as fundamentally system-aware as C or C++.
the only languages i would discount as being systems languages are those that specifically address another platform (jvm, clr) and actively seek to prevent native interaction
| 0 | 13,401 | false | 0 | 1 |
Difference between Systems programming language and Application programming languages
| 4,350,156 |
1 | 2 | 0 | 1 | 1 | 1 | 0.099668 | 0 |
python programmers,
I'm am new to python ,I read that we have built in functions to achieve file compression in python . I just wanted to know if a file compression can be done without using these built in functions (maybe a longer code perhaps) .I wanted to understand the working of these built in functions(how they are coded) basically .
forgive the fallacies(if any) of a beginner,
thanks in advance
| 0 |
python,file,compression
|
2010-12-03T18:30:00.000
| 0 | 4,348,660 |
If you would like to learn more about how file compression works, the code is available right in the python source code in the file gzip.py. You should also check out the zlib source code, on which the gzip module is based.
You can get zlib source code from zlib.net.
| 0 | 419 | false | 0 | 1 |
file compression without using built in functions
| 4,348,705 |
2 | 4 | 0 | 3 | 3 | 1 | 0.148885 | 0 |
I'm currently in college, and we work in groups of three to create small python projects on a weekly basis.
We code with Eclipse and PyDev but we've got a problem when it comes to sharing our work. We end up sending an infinite stream of emails with compressed projects.
What we need is a way to keep the source code updated and we need to be able to share it between us. (on both Windows and Linux) What do you recommend?
thanks in advance.
| 0 |
python,eclipse
|
2010-12-03T22:53:00.000
| 1 | 4,350,627 |
I'd suggest using a version control system.
Git might be good for you - it doesn't require a central server and there is also support for Windows these days.
| 0 | 582 | false | 0 | 1 |
Code sharing between small student group
| 4,350,649 |
2 | 4 | 0 | 1 | 3 | 1 | 0.049958 | 0 |
I'm currently in college, and we work in groups of three to create small python projects on a weekly basis.
We code with Eclipse and PyDev but we've got a problem when it comes to sharing our work. We end up sending an infinite stream of emails with compressed projects.
What we need is a way to keep the source code updated and we need to be able to share it between us. (on both Windows and Linux) What do you recommend?
thanks in advance.
| 0 |
python,eclipse
|
2010-12-03T22:53:00.000
| 1 | 4,350,627 |
What you need is a control version server (SVN for instance). You will be able to commit the changes and update the local version of your code to the current server version.
It is for free:
http://code.google.com/
You should set up your repo and share your work! :-)
I hope it helps.
| 0 | 582 | false | 0 | 1 |
Code sharing between small student group
| 4,350,652 |
1 | 1 | 0 | 9 | 2 | 0 | 1.2 | 0 |
I am working with Google App Engine python version. The app sends an
email to the user with a link to a page to upload an image as an
avatar. It would be nice to have the email so that I can associate the
avatar with that email. How can I get the email of the person who just clicked the link? Thank you.
| 0 |
python,google-app-engine,email
|
2010-12-05T00:56:00.000
| 0 | 4,356,776 |
Put a hash in the URL that uniquely identifies the address you sent it to.
| 0 | 1,324 | true | 1 | 1 |
How do I get the email address of the person who clicked the link in the email?
| 4,356,783 |
2 | 4 | 0 | 0 | 1 | 1 | 0 | 0 |
A friend of mine that is a programmer told me that "Python is written in Python" or something like that. He meant that Python interpreter is written in Python (I think). I've read in some websites that Python interpret in real time ANY programming language (even C++ and ASM). Is this true?
Could someone explain me HOW COULD IT BE?
The unique explanation that I came up with after thinking a bit is: python is at the same "level" of ASM, it makes sense to python interpret any language (that is in a higher level), am I right? Does this make sense?
I would be grateful is someone explain me a little about it.
Thank you
| 0 |
python,compiler-construction,programming-languages,interpreter
|
2010-12-06T08:32:00.000
| 0 | 4,364,507 |
Generally, when someone says language X is written in X, they mean that first a compiler or interpreter for X was written in assembly or other such language, compiled, and then a better compiler or interpreter was written in X.
Additionally, once a very basic compiler/interpreter for X exists, it is sometimes easier to add new language features, classes, etc. to X by writing them in X than to extend the compiler/interpreter itself.
| 0 | 155 | false | 0 | 1 |
Question about python construction
| 4,364,520 |
2 | 4 | 0 | 5 | 1 | 1 | 0.244919 | 0 |
A friend of mine that is a programmer told me that "Python is written in Python" or something like that. He meant that Python interpreter is written in Python (I think). I've read in some websites that Python interpret in real time ANY programming language (even C++ and ASM). Is this true?
Could someone explain me HOW COULD IT BE?
The unique explanation that I came up with after thinking a bit is: python is at the same "level" of ASM, it makes sense to python interpret any language (that is in a higher level), am I right? Does this make sense?
I would be grateful is someone explain me a little about it.
Thank you
| 0 |
python,compiler-construction,programming-languages,interpreter
|
2010-12-06T08:32:00.000
| 0 | 4,364,507 |
It's not true. The standard implementation of Python - CPython - is written in C, although much of the standard library is written in Python. There are other implementations in Java (Jython) and .NET (IronPython).
There is a project called PyPy which, among other things, is rewriting the C parts of Python into Python. But the main development of Python is still based on C.
| 0 | 155 | false | 0 | 1 |
Question about python construction
| 4,364,861 |
1 | 2 | 0 | 1 | 3 | 0 | 0.099668 | 1 |
I'm looking for a good framework to use for a soap service. I'd prefer to use a pythonic framework, but after looking at soaplib/rpclib (too unstable), SOAPy (doesn't work with 2.7) and ZSI (too...confusing), I'm not sure that's possible.
I'm fine with it being in another language, though I'm hesitant to use php's soap libraries due to some previous issues I've had with php.
Yes, I would very much like to to be SOAP as this is destined to primarily provide data to a Silverlight client, and VS makes it dead simple to work with soap services. And no, it can't be an WCF service as all of the hosts are linux-based.
Much appreciated.
| 0 |
python,silverlight,web-services,soap
|
2010-12-06T21:29:00.000
| 0 | 4,371,139 |
I have used Spring WS, JAVA in my previous project. It worked well, without any glitches. We served more than a million API request a day.
| 0 | 1,264 | false | 0 | 1 |
What is a good framework for a soap service?
| 4,371,795 |
2 | 2 | 0 | 2 | 1 | 1 | 0.197375 | 0 |
I am new to python and one thing I read is python is good for making fast prototype of your product because of its extensive library support. But it is not good(used) for large scale deployment?
Is it true? your comments on this.
I have not seen a place (domain) where it is heavily used although its a beautiful language with big fan following (like php for server scripting, JS for client side; c c++ for systems etc).
| 0 |
python
|
2010-12-07T20:28:00.000
| 0 | 4,381,239 |
The example I would give would be CCP Games who use Python for almost all code, iirc. They run eve online, a MMORPG with the record for the max amount of users online in one persistent universe (over 50 thousand yesterday afternoon for instance). So I would say that is a fairly large scale deployment, in my humble opinion.
| 0 | 675 | false | 0 | 1 |
Python good for prototyping and not for large scale deployment?
| 4,381,283 |
2 | 2 | 0 | 2 | 1 | 1 | 1.2 | 0 |
I am new to python and one thing I read is python is good for making fast prototype of your product because of its extensive library support. But it is not good(used) for large scale deployment?
Is it true? your comments on this.
I have not seen a place (domain) where it is heavily used although its a beautiful language with big fan following (like php for server scripting, JS for client side; c c++ for systems etc).
| 0 |
python
|
2010-12-07T20:28:00.000
| 0 | 4,381,239 |
Google uses it, and I think this is a good example for large-scale deployment. It is not very fast, indeed, but it has awesome C/C++ integration support for the bottlenecks.
| 0 | 675 | true | 0 | 1 |
Python good for prototyping and not for large scale deployment?
| 4,381,275 |
2 | 4 | 0 | 1 | 3 | 1 | 0.049958 | 0 |
I want to start programming in python and I was wondering,
which languages does Python resemble in syntax? I am familiar with .net.
| 0 |
.net,python
|
2010-12-07T21:32:00.000
| 0 | 4,381,806 |
The only language I can think of that looks like Python today is Ruby, but Ruby was actually influenced by Python. It doesn't really look like anything you've ever used in .NET unless you used IronPython or IronRuby.
Don't let that discourage you, Python is very simple to learn and most of the syntax (e.g. operators) won't confuse you.
| 0 | 1,860 | false | 0 | 1 |
Which of the languages does Python resemble in its class syntax?
| 4,381,862 |
2 | 4 | 0 | 4 | 3 | 1 | 0.197375 | 0 |
I want to start programming in python and I was wondering,
which languages does Python resemble in syntax? I am familiar with .net.
| 0 |
.net,python
|
2010-12-07T21:32:00.000
| 0 | 4,381,806 |
Python's abstract syntax is heavily inspired by C, as is its concrete micro-syntax. Its concrete macro-syntax, though is fairly different from C, since it uses indentation and dedentation to delimit blocks, similar to Haskell, F#, ISWIM and a couple of others.
Semantically, Python is probably closer to something like Modula-2 with objects, but dynamically typed, of course.
| 0 | 1,860 | false | 0 | 1 |
Which of the languages does Python resemble in its class syntax?
| 4,383,242 |
1 | 5 | 0 | 11 | 37 | 1 | 1 | 0 |
Python packaging tools expect that our readme file should be named README or README.txt. But if we follow this convention, GitHub displays it as plain text in the project page which is not pretty. (unlike the beautiful HTML version when named as README.rst)
Is there any technique to make both PyPI and GitHub happy about README.
| 0 |
python,github
|
2010-12-08T06:33:00.000
| 0 | 4,384,796 |
A crude way I can think of is to make a symlink to README called README.rst and check them both in.
| 0 | 11,100 | false | 0 | 1 |
README extension for Python projects
| 4,384,952 |
2 | 5 | 0 | 13 | 28 | 1 | 1 | 0 |
Pylint looks like a good tool for running analysis of Python code.
However, our main objective is to catch any potential bugs and not coding conventions. Enabling all Pylint checks seems to generate a lot of noise. What is the set of Pylint features you use and is effective?
| 0 |
python,static-analysis,pylint
|
2010-12-09T06:29:00.000
| 0 | 4,395,499 |
To persistently disable warnings and conventions:
Create a ~/.pylintrc file by running pylint --generate-rcfile > ~/.pylintrc
Edit ~/.pylintrc
Uncomment disable= and change that line to disable=W,C
| 0 | 32,053 | false | 0 | 1 |
Pylint best practices
| 19,118,976 |
2 | 5 | 0 | 7 | 28 | 1 | 1 | 0 |
Pylint looks like a good tool for running analysis of Python code.
However, our main objective is to catch any potential bugs and not coding conventions. Enabling all Pylint checks seems to generate a lot of noise. What is the set of Pylint features you use and is effective?
| 0 |
python,static-analysis,pylint
|
2010-12-09T06:29:00.000
| 0 | 4,395,499 |
-E will only flag what Pylint thinks is an error (i.e., no warnings, no conventions, etc.)
| 0 | 32,053 | false | 0 | 1 |
Pylint best practices
| 4,977,086 |
1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
Which one of Ruby-PHP-Python is best suited for Cassandra/Hadoop on 500M+ users? I know language itself is not a big concern but I like to know base on proven success, infrastructure and available utilities around those frameworks! thanks so much.
| 1 |
php,python,ruby-on-rails,scalability,cassandra
|
2010-12-09T12:46:00.000
| 0 | 4,398,341 |
Because Cassandra is written in Java, a client also in Java would likely have the best stability and maturity for your application.
As far as choosing between those 3 dynamic languages, I'd say whatever you're most comfortable with is best. I don't know of any significant differences between client libraries in those languages.
| 0 | 339 | false | 1 | 1 |
Scability of Ruby-PHP-Python on Cassandra/Hadoop on 500M+ users
| 9,921,879 |
2 | 6 | 0 | 0 | 12 | 1 | 0 | 0 |
I'm converting some python code to java, and have a situation where I need to call methods of an object but don't know which methods until runtime. In python I resolve this by using getattr on my object and passing it a string that is the name of my method. How would you do something similar in Java?
| 0 |
java,python,reflection
|
2010-12-09T12:56:00.000
| 0 | 4,398,432 |
The easiest way to handle this is to create a Map object in Java class & keep adding the name value pairs & retrieve it accordingly though it might not support different types that setAttr supports.
| 0 | 4,915 | false | 1 | 1 |
Java equivalent of python's getattr?
| 54,568,702 |
2 | 6 | 0 | 0 | 12 | 1 | 0 | 0 |
I'm converting some python code to java, and have a situation where I need to call methods of an object but don't know which methods until runtime. In python I resolve this by using getattr on my object and passing it a string that is the name of my method. How would you do something similar in Java?
| 0 |
java,python,reflection
|
2010-12-09T12:56:00.000
| 0 | 4,398,432 |
In Java you do this with the Reflection API (and it's usually pretty cumbersome).
MethodUtils in Apache Commons BeanUtils project may make it a bit easier to work with, though it's a pretty hefty dependency for something simple like this.
| 0 | 4,915 | false | 1 | 1 |
Java equivalent of python's getattr?
| 4,398,473 |
1 | 1 | 0 | 10 | 9 | 0 | 1.2 | 0 |
Under what circumstances would something like eventlet/gevent be better than twisted? Twisted seems like the most used, but eventlet/gevent must have some advantages...
I'm not looking for an answer to a specific scenario, just generalities.
| 0 |
python,twisted,gevent,eventlet
|
2010-12-10T04:29:00.000
| 0 | 4,405,667 |
It's an issue of aesthetic preference, I think.
First of all, eventlet can actually use Twisted for networking, so in a sense, it's not an either-or question, it's a this-is-built-on-top-of-that question.
Personally, I don't see the need for libraries like gevent or eventlet, especially since the advent of the @inlineCallbacks decorator in Twisted, which already write code which sorta looks like it's blocking.
But, if you have a large library of code which already uses threads, and you want to port it to be event-driven, something like eventlet can save you some typing, since you don't need to insert 'yield's everywhere.. Some people, like the guys behind the EVE online game, think that code written in this style is just better for some things, such as AI code.
| 0 | 2,369 | true | 0 | 1 |
Twisted, gevent eventlet - When would I use them
| 4,411,300 |
1 | 3 | 0 | 0 | 2 | 0 | 0 | 1 |
Would anyone happen to know what the maximum user ID is on Twitter? That is by now there are about 200mil users, so would the id's range from 1 - 200million? I am finding that in that range some of the id's are not used.
I have a python script that is basically accessing the following url:
"/1/statuses/user_timeline/" + str(user_id) + ".json?count=200"
Thanks,
| 0 |
python,twitter,oauth
|
2010-12-10T06:57:00.000
| 0 | 4,406,448 |
No one knows that.
There were discussions on that in relation of how many users twitter really has.
There were a lot of tests as well as probing of id ranges etc.
The results were that the ids were sequentially incrementing a long time, but then had regular gaps of about 10 between them, and sometimes also seemed to be complelety random.
I don't know how accurately this information was collected, and the goal was something else, but I think you get the point.
From a technical point of view I would expect nothing else in a network as big as twitter.
I am pretty sure the IDs are sharded, which means they are assigned in special reagions or servers.
So that for example if your ID equals mudolo 17 I know I have to look on that very server. Or in that very country. Or something.
Or maby the server just have their own prefix or residue class for assigning ids when a new user signs up to avoid replication problems.
It is also in most cases uncommon, or "not so cool" to leak information as this.
Don't ask me why, its just my esperience that comapnies want to show as least information to the outside as possible.
This includes not having an reproduceable transparanet id incremention system.
It is also vulnerable for some sort of harmful attacks, unwanted crawling, stuff like that.
So my point is.
There is no way of giving you a reliable answer. And it should not be necessary.
You should design your application do deal with eveyr possible situation.
If you want to know how big you should make your database field not to get any conflicts.
I think integer should be fine for now. (even on 32 bit systems)
But always be prepared to upgrade.
Especially don't assume that it will stay numeric. Its just a unique string!
| 0 | 3,366 | false | 0 | 1 |
Max Twitter ID?
| 4,406,528 |
3 | 6 | 0 | 2 | 12 | 0 | 0.066568 | 0 |
i'm writing a python application that uses a command line utility (propietary so it can't be modified) to do part of its work. The problem is that I have to pass the password as a command line argument to the tool which would easily be seen by any user doing 'ps ax'. How can I send the password to the command line tool safely from within python (or a shell script)?
| 0 |
python,bash,shell
|
2010-12-10T10:25:00.000
| 1 | 4,407,843 |
If the password is only accepted on the command line, you're pretty much out of luck. Are you absolutely sure there's no option to send the password in another way? If you can send it over the process's stdin, you can talk to it via a pipe, and send the password securely in that way.
| 0 | 4,756 | false | 0 | 1 |
sending password to command line tools
| 4,408,136 |
3 | 6 | 0 | 0 | 12 | 0 | 0 | 0 |
i'm writing a python application that uses a command line utility (propietary so it can't be modified) to do part of its work. The problem is that I have to pass the password as a command line argument to the tool which would easily be seen by any user doing 'ps ax'. How can I send the password to the command line tool safely from within python (or a shell script)?
| 0 |
python,bash,shell
|
2010-12-10T10:25:00.000
| 1 | 4,407,843 |
You may be able to gain more security by having an encrypted password argument and passing an encrypted password, and the program can de-crypt it. At least there would be no plain-text password floating around. I used this method when launching a process via another process and passing it arguments. It may not be feasible in your case though.
| 0 | 4,756 | false | 0 | 1 |
sending password to command line tools
| 13,034,720 |
3 | 6 | 0 | 0 | 12 | 0 | 0 | 0 |
i'm writing a python application that uses a command line utility (propietary so it can't be modified) to do part of its work. The problem is that I have to pass the password as a command line argument to the tool which would easily be seen by any user doing 'ps ax'. How can I send the password to the command line tool safely from within python (or a shell script)?
| 0 |
python,bash,shell
|
2010-12-10T10:25:00.000
| 1 | 4,407,843 |
Write another python script that will accept password from command prompt using getpass.getpass() and store it in a variable. Then call the command from the script with that variable having password as parameter.
| 0 | 4,756 | false | 0 | 1 |
sending password to command line tools
| 13,034,839 |
1 | 3 | 0 | 0 | 0 | 0 | 0 | 0 |
The question pretty much says it all. The database is in MySQL using phpMyAdmin.
A little background: I'm writing the interface for a small non-profit organization. They need to be able to see which customers to ship to this month, which customers have recurring orders, etc. The current system is ancient, written in PHP 4, and I'm in charge of upgrading it. I spoke with the creator of the current system, and he agreed that it would be better to just write a new interface.
I'm new to Python, SQL and PHP, so this is a big learning opportunity for me. I'm pretty excited. I do have a lot of programming experience though (C, Java, Objective-C), and I don't anticipate any problems picking up Python.
So here I am!
Thanks in advance for all your help.
| 1 |
php,python,mysql,phpmyadmin
|
2010-12-10T22:23:00.000
| 0 | 4,413,840 |
What can I say? Just download the various software, dig in and ask questions here when you run into specific problems.
| 0 | 186 | false | 0 | 1 |
I have a MySQL database, I want to write an interface for it using Python. Help me get started, please!
| 4,413,898 |
1 | 4 | 0 | -2 | 12 | 1 | -0.099668 | 0 |
What i'd like to have is a mechanism that all commands i enter on a Bash-Terminal are wrapped by a Python-script. The Python-script executes the entered command, but it adds some additional magic (for example setting "dynamic" environment variables).
Is that possible somehow?
I'm running Ubuntu and Debian Squeezy.
Additional explanation:
I have a property-file which changes dynamically (some scripts do alter it at any time). I need the properties from that file as environment variables in all my shell scripts. Of course i could parse the property-file somehow from shell, but i prefer using an object-oriented style for that (especially for writing), as it can be done with Python (and ConfigObject).
Therefore i want to wrap all my scripts with that Python script (without having to modify the scripts themselves) which handles these properties down to all Shell-scripts.
This is my current use case, but i can imagine that i'll find additional cases to which i can extend my wrapper later on.
| 0 |
python,linux,bash
|
2010-12-11T19:00:00.000
| 1 | 4,418,378 |
There is no direct way you can do it .
But you can make a python script to emulate a bash terminal and you can use the beautiful "Subprocess" module in python to execute commnands the way you like
| 0 | 3,793 | false | 0 | 1 |
Wrap all commands entered within a Bash-Shell with a Python script
| 4,420,885 |
1 | 2 | 0 | 0 | 4 | 0 | 0 | 0 |
I have a python script that calls a USB-based data-acquisition C# dotnet executable. The main python script does many other things, e.g. it controls a stepper motor. We would like to check the relative timing of various operations, for that purpose the dotnet exe generates a log with timestamps from C# Stopwatch.GetTimestamp(), which as far as I know yields the same number as calls to win32 API QueryPerformanceCounter().
Now I would like to get similar numbers from the python script. time.clock() returns such values, unfortunately it subtracts the value obtained at the time of 1st call to time.clock(). How can I get around this? Is it easy to call QueryPerformanceCounter() from some existing python module or do I have to write my own python extension in C?
I forgot to mention, the python WMI module by Tim Golden does this:
wmi.WMI().Win32_PerfRawData_PerfOS_System()[0].Timestamp_PerfTime
, but it is too slow, some 48ms overhead. I need something with <=1ms overhead. time.clock() seems to be fast enough, as is c# Stopwatch.GetTimestamp().
TIA,
Radim
| 0 |
python,winapi,api,performancecounter
|
2010-12-13T15:10:00.000
| 1 | 4,430,227 |
You could just call the C# StopWatch class directly from Python couldn't you? Maybe a small wrapper is needed (don't know Python/C# interop details - sorry) - if you are already using C# for data acquisition, doing the same for timings via Stopwatch should be simpler than anything else you can do.
| 0 | 1,794 | false | 0 | 1 |
python on win32: how to get absolute timing / CPU cycle-count
| 4,430,461 |
1 | 2 | 0 | 1 | 2 | 0 | 0.099668 | 0 |
I have a script, called test.py, that does the following:
while (1):
....print "hello world"
(this script simply prints 'hello world' continuously).
Now, I am using two machines (machine A and machine B). Same user is used for both machines. I would like to do the following:
(1) [working with machine A] run test.py programatically on machine A { meaning, a local python script will be running test.py using say os.system(....) }
( at this point, the script test.py is printing "hello world" to the screen of machine A )
(2) [working with machine B] I now want to log in into machine A using ssh and 'view' the output of the script that we ran in (1)
How do I achieve this? I know how to write the script that will be running and starting test.py on machine A. I also know how to ssh from machine B to machine A.
What I don't know is:
(*) What command should I use in (1) in order to run the python script so that its output can be easily viewed while logging from a different machine (machine B) to machine A?
(*) Following the ssh from machine B to machine A, how do I 'navigate' to the screen that shows the output of test.py?
| 0 |
python,linux,ubuntu,ssh
|
2010-12-13T15:26:00.000
| 1 | 4,430,408 |
A very quick alternative is to pipe the output of your python program to a file, and then simply using tail with the second user to see the output as it's being written to the file. However, with a program like you have there, the file will very quickly become massive.
| 0 | 1,034 | false | 0 | 1 |
View Script Output Over SSH?
| 4,430,456 |
1 | 2 | 0 | 3 | 11 | 1 | 0.291313 | 0 |
I'm doing some feasibility research with regards to a (large) book cataloging project. Any help would w/r/t good sources of information would be appreciated but the things I would specifically like to know are:
1.)does python have any modules for use with barcode readers (preferably USB)? What other programs are available for reading barcode information?
2.)This may be better answered with a few sources of information, but what kinds of things should I look for in a barcode scanner, especially if I'm looking to scan, specifically, a lot of barcodes on books.
3.)This may also be better answered with a few sources of information, what kind of information is stored standard in a book's barcode.
I know this is relatively off-topic, but any help would be greatly appreciated.
| 0 |
python,barcode,barcode-scanner
|
2010-12-14T00:55:00.000
| 0 | 4,434,959 |
Are you making a python web-app or a client application? Unless you're looking for specialized bar code scanning functionality it doesn't really matter since the input from the scanner appears like keyboard entry (sometimes prefixed with a special input character), so you just have to have a way of listening to the keyboard input and catching that special character.
| 0 | 4,396 | false | 0 | 1 |
USB Barcode scanner research
| 4,435,008 |
1 | 2 | 0 | 18 | 5 | 0 | 1.2 | 0 |
when I use pssh, trying to access a remote machine which is not inside the UNIX
known hosts file, pssh freeze after giving the password.
After having added the host using a direct ssh command, pssh works.
So is there an option to give to the pssh command in order to avoid this problem ?
Thanks for your help,
Regards
| 0 |
python,ssh
|
2010-12-14T08:47:00.000
| 1 | 4,437,331 |
Try pssh -O StrictHostKeyChecking=no. This works for me.
By default ssh uses the value of "ask", which causes it to ask the user whether to continue connecting to unknown host. By setting the value to "no", you avoid the question, but are no longer protected against certain attacks. E.g. if you are connecting to hostA, and someone puts hostB there with the same IP address, then by default ssh will notice that hostB has changed, and will prompt you about it. With StrictHostKeyChecking=no, it will silently assume everything is OK.
| 0 | 12,459 | true | 0 | 1 |
pssh and known_hosts file
| 4,441,673 |
2 | 3 | 0 | 0 | 0 | 0 | 0 | 0 |
On the front-end, I have a PHP webapp that allows users to create a list of their websites (5 max).
On the back-end, a Python script runs daily (and has ~10 iterations) for each website that the user registers. Each script per website takes about 10 seconds to run through all iterations and finish its scraping. It then makes a CSV file with its findings.
So, in total, that's up to (5 websites * 10 iterations =) 50 iterations at 8.3 total minutes per user.
Right now, the script works when I manually feed it a URL, so I'm wondering how to make it dynamically part of the webapp.
How do I programmatically add and remove scripts that run daily depending on the number of users and the websites each user has each day?
How would I schedule this script to run for each website of each user, passing in the appropriate parameters?
I'm somewhat acquainted with cronjobs, as it's the only thing I know of that is made for routine processes.
| 0 |
php,python,design-patterns,cron,screen-scraping
|
2010-12-14T17:06:00.000
| 0 | 4,441,933 |
Do you need to run the script 50 times per user, or only when the user has logged into your service to check on things?
| 0 | 772 | false | 1 | 1 |
Best practice for running a daily Python screen-scraping script 50 times (8.3 minutes total) per user?
| 4,441,983 |
2 | 3 | 0 | 0 | 0 | 0 | 0 | 0 |
On the front-end, I have a PHP webapp that allows users to create a list of their websites (5 max).
On the back-end, a Python script runs daily (and has ~10 iterations) for each website that the user registers. Each script per website takes about 10 seconds to run through all iterations and finish its scraping. It then makes a CSV file with its findings.
So, in total, that's up to (5 websites * 10 iterations =) 50 iterations at 8.3 total minutes per user.
Right now, the script works when I manually feed it a URL, so I'm wondering how to make it dynamically part of the webapp.
How do I programmatically add and remove scripts that run daily depending on the number of users and the websites each user has each day?
How would I schedule this script to run for each website of each user, passing in the appropriate parameters?
I'm somewhat acquainted with cronjobs, as it's the only thing I know of that is made for routine processes.
| 0 |
php,python,design-patterns,cron,screen-scraping
|
2010-12-14T17:06:00.000
| 0 | 4,441,933 |
Assuming you're using a database to store the users' web sites, you can have just 1 script that runs as a daily cron job and queries the database for the list of sites to process.
| 0 | 772 | false | 1 | 1 |
Best practice for running a daily Python screen-scraping script 50 times (8.3 minutes total) per user?
| 4,441,994 |
3 | 5 | 0 | 0 | 0 | 1 | 0 | 0 |
I have around 80 lines of a function in a file. I need the same functionality in another file so I am currently importing the other file for the function.
My question is that in terms of running time on a machine which technique would be better :- importing the complete file and running the function or copying the function as it is and run it from same package.
I know it won't matter in a large sense but I want to learn it in the sense that if we are making a large project is it better to import a complete file in Python or just add the function in the current namespace.....
| 0 |
python
|
2010-12-14T19:50:00.000
| 0 | 4,443,509 |
If the two modules are unrelated except for that common function, you may wish to consider extracting that function (and maybe other things that are related to that function) into a third module.
| 0 | 143 | false | 0 | 1 |
Is importing a file good in Python
| 4,443,870 |
3 | 5 | 0 | 1 | 0 | 1 | 0.039979 | 0 |
I have around 80 lines of a function in a file. I need the same functionality in another file so I am currently importing the other file for the function.
My question is that in terms of running time on a machine which technique would be better :- importing the complete file and running the function or copying the function as it is and run it from same package.
I know it won't matter in a large sense but I want to learn it in the sense that if we are making a large project is it better to import a complete file in Python or just add the function in the current namespace.....
| 0 |
python
|
2010-12-14T19:50:00.000
| 0 | 4,443,509 |
Importing is good cause it helps you manage stuff easily. What if you needed the same function again? Instead of making changes at multiple places, there is just one centralized location - your module.
In case the function is small and you won't need it anywhere else, put it in the file itself.
If it is complex and would require to be used again, separate it and put it inside a module.
Performance should not be your concern here. It should hardly matter. And even if it does, ask yourself - does it matter to you?
| 0 | 143 | false | 0 | 1 |
Is importing a file good in Python
| 4,443,553 |
3 | 5 | 0 | 4 | 0 | 1 | 1.2 | 0 |
I have around 80 lines of a function in a file. I need the same functionality in another file so I am currently importing the other file for the function.
My question is that in terms of running time on a machine which technique would be better :- importing the complete file and running the function or copying the function as it is and run it from same package.
I know it won't matter in a large sense but I want to learn it in the sense that if we are making a large project is it better to import a complete file in Python or just add the function in the current namespace.....
| 0 |
python
|
2010-12-14T19:50:00.000
| 0 | 4,443,509 |
Importing is how you're supposed to do it. That's why it's possible. Performance is a complicated question, but in general it really doesn't matter. People who really, really need performance, and can't be satisfied by just fixing the basic algorithm, are not using Python in the first place. :) (At least not for the tiny part of the project where the performance really matters. ;) )
| 0 | 143 | true | 0 | 1 |
Is importing a file good in Python
| 4,443,551 |
1 | 3 | 0 | 2 | 3 | 1 | 0.132549 | 0 |
I am looking to implement a simple project that backs up files and encrypts them using AES.
The normal backing up part is done thanks to how Python handles everything ... however I need to encrypt the data also.
So my questions are:
Is AES the best encryption algorithm for encrypting the files or I can do better?
What is the best Python library for encrypting stuff? I searched and came across M2Crypto and PyCrypto. Any differences/ which one should I favour?
Is this going to be secure? I mean, I will be typing the key everytime I need to encrypt / decrypt and so I will be getting the key from raw_input. Is this OK?
If you have any suggestions, feel free to let me know.
Thanks.
| 0 |
python,encryption,aes
|
2010-12-15T18:57:00.000
| 0 | 4,453,724 |
Ideally, you would not be at a cipher level in order to secure your data. If nothing else, use an existing, proven secure, framework such as GPG to handle file encryption. This is driven home by your question regarding AES: you haven't even mentioned what cipher modes you were considering (CBC, XTR, CTR, CFB, EBC, etc).
| 0 | 2,086 | false | 0 | 1 |
AES encryption of files with Python
| 4,453,804 |
2 | 2 | 0 | 1 | 1 | 0 | 0.099668 | 0 |
I have a python script which I would like to launch from inittab, shown below
s1:respawn:/home/a_user/app/script.py
I believe initab executes as root, so the a_user's envrinment is not available
The script needs to know "a_user" home directory for ini file settings and log file storage. I would like to avoid hard coding these paths in my script. Is it possible to execute this script as a_user and not a root? If this is possible would a_user HOME environment variable be available?
Regards
| 0 |
python,root
|
2010-12-15T23:21:00.000
| 1 | 4,455,973 |
you could copy python binary to python-suid,
chown it to user you want to run scripts as and chown u+s python-suid
then in script #!/usr/bin/python-suid
| 0 | 1,378 | false | 0 | 1 |
Executing a python script from inittab not as root
| 4,456,065 |
2 | 2 | 0 | 1 | 1 | 0 | 0.099668 | 0 |
I have a python script which I would like to launch from inittab, shown below
s1:respawn:/home/a_user/app/script.py
I believe initab executes as root, so the a_user's envrinment is not available
The script needs to know "a_user" home directory for ini file settings and log file storage. I would like to avoid hard coding these paths in my script. Is it possible to execute this script as a_user and not a root? If this is possible would a_user HOME environment variable be available?
Regards
| 0 |
python,root
|
2010-12-15T23:21:00.000
| 1 | 4,455,973 |
Use runuser (or the distro's equvalent) to run it as a different user. runuser does change $HOME, but other similar commands may not.
| 0 | 1,378 | false | 0 | 1 |
Executing a python script from inittab not as root
| 4,456,006 |
1 | 1 | 0 | 3 | 11 | 1 | 1.2 | 0 |
I know it is possible to use Powershell from within IronPython, but is this possible using CPython beyond using Popen() and other similar calls? I'm trying to do some very basic NET framework programming (windows Forms, etc.) like you can do inside of IronPython using CPython.
Thanks!
Any help appreciated.
| 0 |
python,powershell
|
2010-12-15T23:25:00.000
| 0 | 4,455,999 |
I am not sure why you got downvoted as this is a legitimate question. I think the best integration you are going to get trying to integrate PowerShell into CPython will be through spawning a new process and passing in the PowerShell script you want run. Unfortunately this will also mean parsing any output that is generated as well. There is not a COM or C library you can really link against to get much better.
There might be some sort of a general .NET interop library for CPython (I haven't checked), but that may be an option, using that layer you could (at least in theory) use the same techniques as embedding the PowerShell runtime into a regular .NET App.
| 0 | 2,213 | true | 0 | 1 |
Powershell integration with Python (not IronPython)
| 4,456,153 |
1 | 4 | 0 | 0 | 0 | 1 | 0 | 0 |
I have this text in a file - Recuérdame (notice it's a French word). When I read this file with a python script, I get this text as Recuérdame.
I read it as a unicode string. Do I need to find what the encoding of the text is & decode this? or is my terminal playing tricks on me?
| 0 |
python,text,encoding,character-encoding,decoding
|
2010-12-16T06:34:00.000
| 0 | 4,458,090 |
Working with xlrd, I have in a line
...xl_data.find(str(cell_value))...
which gives the error:"'ascii' codec can't encode character u'\xdf' in position 3: ordinal not in range(128)".
All suggestions in the forums have been useless for my german words.
But changing into:
...xl_data.find(cell.value)...
gives no error.
So, I suppose using strings as arguments in certain commands with xldr has specific encoding problems.
| 0 | 3,875 | false | 0 | 1 |
Python Text Encoding
| 14,012,214 |
1 | 1 | 0 | 1 | 2 | 1 | 0.197375 | 0 |
I have an application written in IronPython which uses classes and methods from imported .NET assembly (compiled with debug support). When a method in assembly throws an exception, it gets caught in IronPython code as Exception (not System.Exception) and the traceback ends at last IronPython method.
What I would like to do is to go deeper and append the original CLI traceback after last IronPython method to see where the exception occured inside the assembly.
Is it possible to get original CLI exception from caught IronPython equvivalent or catch it without loosing IronPython's stack trace?
Thanx.
| 0 |
ironpython
|
2010-12-16T13:27:00.000
| 0 | 4,461,191 |
You can get the ExceptionOperations object from scriptEngine.GetService(). You can then call FormatException or GetStackFrames. You can also set the ExceptionDetail option to true to get more verbose stack traces from FormatException.
| 0 | 323 | false | 0 | 1 |
Combine IronPython's and CLI stack trace
| 4,467,668 |
1 | 2 | 0 | 2 | 5 | 0 | 1.2 | 0 |
I'm using emacs23 with tramp to modify python scripts on a remote host.
I found that when I start the python shell within emacs it starts up
python on the remote host.
My problem is that when I then try to call python-send-buffer via C-c C-c it comes up with the error
Traceback (most recent call last):
File "", line 1, in ?
ImportError: No module named emacs
Traceback (most recent call last):
File "", line 1, in ?
NameError: name 'emacs' is not defined
Now, I must admit that I don't really know what's going on here. Is there a way for me to configure emacs so that I can evaluate the buffer on the remote host?
Many thanks.
Edit: I've followed eichin's advice and re-implemented python-send-region. See my answer below.
| 0 |
python,emacs
|
2010-12-16T21:39:00.000
| 1 | 4,465,615 |
Short answer: not without writing some missing elisp code.
Long version: In python.el, run-python adds data-directory (which on my Ubuntu 10.10 box is /usr/share/emacs/23.1/etc/ ) to $PYTHONPATH, specifically so that it can find emacs.py (as supplied by the local emacs distribution.) Then it does a (python-send-string "import emacs") and expects it to work...
It looks like the defadvice wrappers that tramp uses don't actually pass PYTHONPATH, so this doesn't work even if you have the matching emacs version on the remote system.
If you M-x customize-variable RET tramp-remote-process-environment RET
then hit one of the INS buttons and add PYTHONPATH=/usr/share/emacs/23.1/etc then hit STATE and set it to "current session" (just to test it, or "save for future sessions" if it works for you) it almost works - the complaint goes away, in any case, because the remote python can now find the remote emacs.py. If you now go back to the original question, doing python-send-buffer, you just run into a different error: No such file or directory: '/tmp/py24574XdA' because python-mode just stuffs the content into a temporary file and tells the python subprocess to load that.
You'd have to change python-send-region (the other functions call it) and particularly the way it uses make-temp-file to be tramp-aware - there's even a tramp-make-tramp-temp-file you could probably build upon. (Be sure to post it if you do...)
| 0 | 2,594 | true | 0 | 1 |
evaluating buffer in emacs python-mode on remote host
| 4,577,034 |
1 | 3 | 0 | 0 | 10 | 0 | 0 | 0 |
I need a method to generate 3D simplex noise in python rather quickly. What methods are there out there to solve this problem?
| 0 |
python,noise
|
2010-12-17T04:14:00.000
| 0 | 4,467,638 |
use a mod function with a suitable period. there are quite a few pages around the www explaining mod functions.
just make sure it is also suitable for 3 dimensions, some mods that are suitable for 1 or 2 dimensions may not be suitable over 3.
| 0 | 5,673 | false | 0 | 1 |
Generating 3D noise quickly in python
| 4,467,703 |
4 | 5 | 0 | 11 | 2 | 1 | 1 | 0 |
Which is better to use in a python automation script for following simple operations
To create a zip file and copy it or rename it to a new location.
Using python inbuilt functions or terminal commands through os.system modules is better?
| 0 |
python
|
2010-12-17T12:08:00.000
| 1 | 4,470,302 |
The inbuilt Python modules/ stdlib wherever you can, subprocess (os.system) where you must.
Reasons: Portability, maintenance, code readability just to name a few.
| 0 | 211 | false | 0 | 1 |
Which is better? Using inbuilt python functions or os.system commands?
| 4,470,327 |
4 | 5 | 0 | 2 | 2 | 1 | 0.07983 | 0 |
Which is better to use in a python automation script for following simple operations
To create a zip file and copy it or rename it to a new location.
Using python inbuilt functions or terminal commands through os.system modules is better?
| 0 |
python
|
2010-12-17T12:08:00.000
| 1 | 4,470,302 |
I would say python ones since it'll make the script portable. But sometimes, performance and availability are of concerns.
| 0 | 211 | false | 0 | 1 |
Which is better? Using inbuilt python functions or os.system commands?
| 4,470,324 |
4 | 5 | 0 | 2 | 2 | 1 | 0.07983 | 0 |
Which is better to use in a python automation script for following simple operations
To create a zip file and copy it or rename it to a new location.
Using python inbuilt functions or terminal commands through os.system modules is better?
| 0 |
python
|
2010-12-17T12:08:00.000
| 1 | 4,470,302 |
In general I'd say use the python libraries where possible - that way it'll be more portable, e.g. you won't need to worry about different commands or command options on various systems, and also if you need to change anything it's easier to do just python code.
| 0 | 211 | false | 0 | 1 |
Which is better? Using inbuilt python functions or os.system commands?
| 4,470,331 |
4 | 5 | 0 | 0 | 2 | 1 | 0 | 0 |
Which is better to use in a python automation script for following simple operations
To create a zip file and copy it or rename it to a new location.
Using python inbuilt functions or terminal commands through os.system modules is better?
| 0 |
python
|
2010-12-17T12:08:00.000
| 1 | 4,470,302 |
Using python internals command is nice, especially in terms of portability.
But at some point, you can be confused by lack of "os.kill" in Python older than 2.7 (Windows), you can be surprised by way how os.Popen is working, than you will discover win32pipe etc etc.
Personally I would suggest always a small research (do you need daemons etc) and then decide. If you don't need windows platform - using python's internals could be more efficient.
| 0 | 211 | false | 0 | 1 |
Which is better? Using inbuilt python functions or os.system commands?
| 4,470,576 |
1 | 1 | 0 | 0 | 2 | 0 | 1.2 | 0 |
I am trying to get a decent python environment using emacs. As part of this process i want to integrate pydbgr with emacs.
I have almost done it but with an issue. When i try to start a debugging session pydbgr does not found my modules when i try to import them.
If i change PYTHONPATH and then execute pydbgr from command line all works fine.
So my question is. IS there any way to change python environment so i can debug with pydbgr inside emacs?
Thanks in advance!
| 0 |
python,debugging,emacs
|
2010-12-17T14:47:00.000
| 0 | 4,471,587 |
Use Emacs Lisp function setenv as in:
(setenv "PYTHONPATH" "c:/....")
| 0 | 101 | true | 0 | 1 |
Unable to find modules from pydbgr in emacs
| 4,471,792 |
1 | 1 | 1 | 6 | 9 | 1 | 1.2 | 0 |
If I were to write several classes in c++ then use swig to do the conversion so I could later use them in python, would they run faster or slower than if I completely rewrote them in python? Or is there no noticable speed difference?
| 0 |
c++,python,performance,swig
|
2010-12-18T04:38:00.000
| 0 | 4,476,663 |
The quality and speed of wrappers generated by SWIG is very good, and they will probably perform just as good as handcrafted wrappers.
From my experience, the wrappers themselves are very thin and add very little overhead to the native functions they wrap, making it a perfectly valid choice to use wrapped libraries in python or any other supported language, and is a good way to reuse code.
however, to be if you are interested in performance in addition to code reuse, wrapping native code will probably only pay off if you have some computationally intensive native functions, like multiplying matrices, computing MD5 or CRC, folding proteins etc.
on the other hand, sometimes you can just rewrite everything in an easy language like python or C# and enjoy better code and better tools, with comparable performance.
| 0 | 3,456 | true | 0 | 1 |
Speed of swig wrappers
| 4,484,174 |
1 | 1 | 1 | 3 | 2 | 1 | 1.2 | 0 |
I'm trying to create a configuration file for a C# app in IronPython. Is there any way I can have that python file just return a value, or do I have to go through variables/functions to access the results of the script?
i.e., right now I've got Config.py that looks like
x = "test"
and C# code that goes
dynamic pyfile = Python.CreateRuntime().ExecuteFile("Config.py");
Console.WriteLine(pyfile.x);
Is there any way to remove the x?
| 0 |
c#,dynamic,interop,ironpython
|
2010-12-18T19:21:00.000
| 0 | 4,479,679 |
You can create a ScriptSource with SourceCodeKind.AutoDetect and it will return the last expression in the file.
| 0 | 618 | true | 0 | 1 |
How to create an IronPython file that simply returns a single value to C#?
| 4,480,156 |
1 | 1 | 0 | 1 | 4 | 0 | 1.2 | 0 |
I'm designing a distributed system where a master node starts a bunch of worker nodes on remote machines. Since I am using Python and want to take advantage of the fact each physical machine has several cores, I want to run multiple worker nodes per machine (GIL etc). Additionally, each worker node may vary quite a bit in the amount of CPU it requires each "cycle". I can however split the worker nodes into quite a few pieces and my initial strategy will be to spawn many more worker nodes than there are cores per machine. The reasoning being that if a few nodes require more CPU, they can occupy a core for a longer duration. (If each node was already CPU bound, it could not suddenly require more CPU.)
This leads me to a question: How can I accurately gauge the CPU time of a python process?
I cannot measure the time naively, I need the time actually spent specifically for a given process. That is, for each process I want a number X, which, as accurately as possible, represents the amount of CPU resources spent exclusively on that process, regardless of unrelated processes. (I have been looking at Python's getrusage but it appears to give only 2 decimal points of precision on ubuntu, which is insufficient. EDIT: This also happens if I use getrusage() directly in C; at most 0.01 second precision. Close, but no cigar)
My specific use-case would be to measure the CPU time of each node cycle, from Start to End, where End happens about 0-30ms after Start.
The best answer would be a portable way to do this in Python. Methods that requires using C extension is fine.
| 0 |
python,timing
|
2010-12-19T13:44:00.000
| 1 | 4,483,182 |
The quick answer, at least for linux, is to use getrusage along with a kernel that has a higher resolution timer.
The reason my initial tests gave the terrible precision of 10ms was because apparently 64-bit ubuntu is configured to a 100hz timer by default.
| 0 | 334 | true | 0 | 1 |
How can I accurately gauge the CPU time of a python process?
| 4,483,416 |
1 | 1 | 0 | 8 | 6 | 0 | 1.2 | 0 |
I have a python script that I'd like to add to cron.
The script has +x permission on it.
How shall I add it to crontab? (say, I want it to run every minute).
Important: when I navigate (using the shell) to the script's folder, I cannot run it using "./script_name.py"; it doesn't work. Yet, when I run it using "Python script_name.py", everything works.
| 0 |
python,linux,cron,ubuntu-10.04
|
2010-12-20T02:37:00.000
| 1 | 4,486,472 |
From cron you should be running the script as script_name.py and your script meets the following criteria:
Executable bit is set
The script's hash-bang is set correctly eg. #!/usr/bin/env python
it is accessible from the PATH
e.g. place it in /usr/local/bin/ or /opt/local/bin/ (and they are accessible to your system PATH.)
If these conditions are met, you should be able to run it from anywhere on your local system as script_name.py
| 0 | 4,736 | true | 0 | 1 |
Running a Python Script using Cron?
| 4,486,483 |
1 | 1 | 0 | 2 | 1 | 1 | 1.2 | 0 |
I'm writing a Python module in C and I intend to mmap largeish blocks of memory (perhaps 500 MB). Is there anything about working in the same process space as the Python interpreter that I should be careful of?
| 0 |
python,c,mmap,cpython,memory-mapping
|
2010-12-21T12:59:00.000
| 0 | 4,499,483 |
No, you're fine.
On 32-bit systems, you could run out of virtual memory, or with virtual memory fragmentation not have a single chunk big enough to map as many huge files as you want. But that pitfall isn't particular to CPython.
| 0 | 140 | true | 0 | 1 |
mmapping in Python C modules - any pitfalls to be aware of?
| 4,499,674 |
3 | 7 | 0 | 6 | 15 | 1 | 1 | 0 |
I understand why interpretation overhead is expensive, but why are JITted Python implementations (Psyco and PyPy) still so much slower than other JITted languages like C# and Java?
Edit: I also understand that everything is an object, dynamic typing is costly, etc. However, for functions where types can be inferred, I'm not sure why this matters.
| 0 |
c#,java,python,performance,jit
|
2010-12-21T14:20:00.000
| 0 | 4,500,232 |
People have already pointed out the technical details, so I'll add another factor: money.
In the last few years, Javascript VMs (Google's V8, Mozilla's Tracemonkey & Jaegermonkey, Apple's Nitro) have delivered a huge speed increase for another dynamic language. That's been driven in large part by Google's desire to make web apps more powerful. Python just doesn't have a big company standing to gain by making it 50x faster.
Oh, and the integration with C extensions like numpy means that speed is rarely critical for Python code, anyway.
| 0 | 878 | false | 0 | 1 |
Why are JITted Python implementations still slow?
| 4,500,536 |
3 | 7 | 0 | 1 | 15 | 1 | 0.028564 | 0 |
I understand why interpretation overhead is expensive, but why are JITted Python implementations (Psyco and PyPy) still so much slower than other JITted languages like C# and Java?
Edit: I also understand that everything is an object, dynamic typing is costly, etc. However, for functions where types can be inferred, I'm not sure why this matters.
| 0 |
c#,java,python,performance,jit
|
2010-12-21T14:20:00.000
| 0 | 4,500,232 |
A really good question. I can't give you a complete answer, but I think one of the reasons is the "everything is objects and an object could be anything" concept. In Java, if you try "1.getClass()", it won't work unless you box it first, either explicitly or implicitly. In Python, it works out of the box. But objects are definitely more heavyweight than primitive types, which Python just doesn't seem to have.
The "an object can be anything" part is even more important. If you write "someobject.somefield" in Java, it knows at compile time what exactly is "somefield" and generates code that accesses it directly. Well, there are probably some tricks to give better binary compatibility, but that's nothing like Python, where it actually performs some sort of dictionary look-up at run time to figure out what exactly is "somefield" at that particular moment, as fields can be added and deleted dynamically.
To put it short, Python is more powerful, but that power has its cost.
| 0 | 878 | false | 0 | 1 |
Why are JITted Python implementations still slow?
| 4,500,345 |
3 | 7 | 0 | 0 | 15 | 1 | 0 | 0 |
I understand why interpretation overhead is expensive, but why are JITted Python implementations (Psyco and PyPy) still so much slower than other JITted languages like C# and Java?
Edit: I also understand that everything is an object, dynamic typing is costly, etc. However, for functions where types can be inferred, I'm not sure why this matters.
| 0 |
c#,java,python,performance,jit
|
2010-12-21T14:20:00.000
| 0 | 4,500,232 |
The whole issue is not so clear anymore in 2014. Google's V8 JS engine does some pretty heavy stuff to optimize the hell out of js.
PyPy could be much faster if only enough money would be available. Python's execution speed mostly does not matter so nobody heavily invests in PyPy.
It's really not a technical issue anymore. Look at Java's InvokeDynamic instruction. Sure, those invocations cost more the first time they are called, but the JVM can do magic stuff once those invocations start to start up. That is: The JVM can do assumptions and can learn about the code while running it. If a method always returns an int, it's possible that this method always returns an int. In reality the JVM does much more.
In 2014 it's really not dynamic vs static in terms of performance. Sure C++ will always be the fastest tool around, but jitted dynamic languages are not "magnitudes" slower as they used to be a few years ago.
Wait a few more years, I bet static analysis is much stronger in 2016 or 2017. There are a few very interesting research projects running right now.
In Theory:
You can basically infer every type using static type analysis, you have to understand what the code is doing before it does it. That's not impossible.
When static analysis becomes more powerful, you really do not need a static type system anymore. All static type systems, even haskell's, limit the number of correct programs. So in essence: If you have an analyzer which can proof the correctness of a program by analyzing it is much more powerful as a static type system which only can act within boundaries. And concerning code re-usage: Nothing can beat dynamic typing.
There are a few who would say that dynamic typing is bad for large applications but if static analysis becomes more powerful, you would actually have the same or maybe much more proven correctness as a static type system could ever offer. Of course statically typed languages could also be statically analyzed, but than the static type system would be useless.
So in essence: Here are a lot of if's, i know. But 10 years ago people would have laughed if you would have told them that js becomes the so fast, that you could easily write heavy 3d opengl applications in it.
Never underestimate the future.
| 0 | 878 | false | 0 | 1 |
Why are JITted Python implementations still slow?
| 23,262,554 |
1 | 1 | 0 | 4 | 3 | 0 | 1.2 | 0 |
What is the fastest/most efficient method to execute an executable from python? It seems to me that os.system is faster than subprocess.popen. I would like to be able to read the lines that come out of this other process, but far more important than anything else is speed.
| 0 |
python,linux,subprocess
|
2010-12-21T18:11:00.000
| 1 | 4,502,469 |
I would expect any speed difference between, say, os.system and os.execv and subprocess.Popen, to be swamped by the expense of starting a new process (and the context-switching needed to actually run it). Therefore I recommend using subprocess first and measuring the performance.
One possible performance consideration: os.system and subprocess.Popen(shell=True, ...) cause an extra shell process to be created. In most cases, that shell isn't necessary. It's wasteful to create it; you get twice as many processes as you need for no benefit.
| 0 | 2,379 | true | 0 | 1 |
fastest way to invoke a process from python?
| 4,502,661 |
3 | 4 | 0 | 0 | 2 | 1 | 0 | 0 |
I'm looking to implement a shared configuration file that will be written (output) in python, but be read (input) in C.
The only prerequisite of this configuration file is that it can't be human readable.
Anyone have any suggestions on what file format I should use for this project?
Edit: The file can't be human readable because we don't want the user to be able to modify the configuration, also, in some cases, we don't want the user to know about certain configurations.
| 0 |
c++,python,c,configuration-files
|
2010-12-21T22:16:00.000
| 0 | 4,504,470 |
Use a plain human readable format such as XML, and then obfuscate that to make it uneditable (i.e. encrypt the whole thing and store a hash somewhere and fail to load if its' been messed with).
Otherwise you just have to bite the bullet and write a spec for the binary format that'll be exchanged between the two programs.
| 0 | 754 | false | 0 | 1 |
Shared configuration file format between python and C?
| 4,504,547 |
3 | 4 | 0 | 1 | 2 | 1 | 0.049958 | 0 |
I'm looking to implement a shared configuration file that will be written (output) in python, but be read (input) in C.
The only prerequisite of this configuration file is that it can't be human readable.
Anyone have any suggestions on what file format I should use for this project?
Edit: The file can't be human readable because we don't want the user to be able to modify the configuration, also, in some cases, we don't want the user to know about certain configurations.
| 0 |
c++,python,c,configuration-files
|
2010-12-21T22:16:00.000
| 0 | 4,504,470 |
Probably easiest to use XML, then obfuscate it with a simple cypher or encryption with a fixed key.
| 0 | 754 | false | 0 | 1 |
Shared configuration file format between python and C?
| 4,504,538 |
3 | 4 | 0 | 2 | 2 | 1 | 0.099668 | 0 |
I'm looking to implement a shared configuration file that will be written (output) in python, but be read (input) in C.
The only prerequisite of this configuration file is that it can't be human readable.
Anyone have any suggestions on what file format I should use for this project?
Edit: The file can't be human readable because we don't want the user to be able to modify the configuration, also, in some cases, we don't want the user to know about certain configurations.
| 0 |
c++,python,c,configuration-files
|
2010-12-21T22:16:00.000
| 0 | 4,504,470 |
How secure do you need this config file to be?
There is no absolute security, you'll quickly run into DRM like issues (allow users to open a file but not allow them to open it ... I know it's insane).
Often simple obfuscation is quite effective. Dump the config to a JSON file (please don't use xml). XOR the contents and change the extension. That will stop all casual inspection of the file. Obviously don't document that this is your obfuscation procedure.
If you're worried about user modification of config files (you don't care if the configs are readable you just want prevent loading custom configs) use a cryptographic signature. Store the private key at your company and use it and the python app to generate a signed configuration. Store the public key in the c++ application and use it to verify the config is properly signed before applying the settings.
| 0 | 754 | false | 0 | 1 |
Shared configuration file format between python and C?
| 4,505,256 |
1 | 1 | 0 | 3 | 1 | 0 | 1.2 | 1 |
is there a way to get the date of friendship creation for both my friends and followers in twitter?
especially for python-twitter....
| 0 |
python,twitter,python-twitter
|
2010-12-23T09:11:00.000
| 0 | 4,517,265 |
Twitter doesn't preserve the date a friendship or follow is created, and it doesn't return it in the API. Going forward you can query friends/ids and followers/id every day and record any new relationships with the current date in a database.
| 0 | 316 | true | 0 | 1 |
can i get date of friendship in twitter?
| 4,518,740 |
1 | 2 | 0 | 0 | 0 | 0 | 0 | 0 |
I need a python library or module or whatever that can compare a .wav file to microphone input without too too much code. Sample code would be cool too. TY!
| 0 |
python,audio,comparison,wav
|
2010-12-23T22:36:00.000
| 0 | 4,522,964 |
If you're trying to compare something like, what words people are saying, this would have to be a fairly complex piece of code. You could directly compare them at a frequency/wave level, but you'll very rarely if ever get a match.
| 0 | 1,653 | false | 0 | 1 |
python library to compare a .wav with mic input?
| 4,523,066 |
2 | 3 | 0 | 1 | 0 | 0 | 0.066568 | 1 |
I'm PHP/MySQL developper
I studied python well as a desktop programming two years ago but I don't use it on the web how can I use python to build dynamic web sites and easily uploads these sites to any hosting providers
| 0 |
python
|
2010-12-24T09:58:00.000
| 0 | 4,525,562 |
You cant' upload python files and use it on any webhosting.
You can use them if the host allows it.
Some frameworks are Django or Pylons.
| 0 | 529 | false | 0 | 1 |
how can I use python to build dynamic web sites?
| 4,525,588 |
2 | 3 | 0 | 1 | 0 | 0 | 1.2 | 1 |
I'm PHP/MySQL developper
I studied python well as a desktop programming two years ago but I don't use it on the web how can I use python to build dynamic web sites and easily uploads these sites to any hosting providers
| 0 |
python
|
2010-12-24T09:58:00.000
| 0 | 4,525,562 |
there are many web frameworks such as Django & web2py , you should check them out
| 0 | 529 | true | 0 | 1 |
how can I use python to build dynamic web sites?
| 4,525,568 |
1 | 2 | 0 | 1 | 3 | 1 | 0.099668 | 0 |
I was wondering if someone here had written/uses a script which parses the output of objdump and extracts opcodes from it? I have a very very trivial implementation but I'm looking for something better.
The problem I am facing with this script is simply that it does simple string parsing; this is more of a utility script, and thats why I haven't written tests for these. I was wondering if the same could be done by writing a custom made parser or a simple yet efficient regular expression.
This query is for the purpose of learning, so that I can approach such a problem in a (hopefully)better manner next time.
I don't mind the specifics of the implementation(shell,ruby,python,perl; anything would do). The code does not even matter that much, really, I'd like a few hints on how you would do it.
| 0 |
python,parsing,objdump
|
2010-12-24T16:28:00.000
| 0 | 4,527,313 |
The BEST solution would be to build objdump from source and make a python or other language swig wrapper that gets the output directly. You CAN do it with string parsing, but that's often buggy(read as implemented poorly). It is definitely possible to do the string parsing properly...I have a utility that relies on this.
| 0 | 4,442 | false | 0 | 1 |
parsing objdump output
| 7,283,510 |
2 | 4 | 0 | 1 | 2 | 0 | 0.049958 | 1 |
I am building a GAE site that uses AJAX/JSON for almost all its tasks including building the UI elements, all interactions and client-server requests. What is a good way to test it for highloads so that I could have some statistics about how much resources 1000 average users per some period of time would take. I think I can create some Python functions for this purpose. What can you advise? Thanks.
| 0 |
python,google-app-engine,load-testing
|
2010-12-25T09:37:00.000
| 0 | 4,529,913 |
You can get a free linux micro instance from EC2 and then run ab (apache benchmark) with lots of requests. You can change number of requests, concurrent requests and you can even launch multiple EC2 instances from different data centers.
| 0 | 193 | false | 1 | 1 |
How to test my GAE site for performance
| 4,536,343 |
2 | 4 | 0 | 0 | 2 | 0 | 0 | 1 |
I am building a GAE site that uses AJAX/JSON for almost all its tasks including building the UI elements, all interactions and client-server requests. What is a good way to test it for highloads so that I could have some statistics about how much resources 1000 average users per some period of time would take. I think I can create some Python functions for this purpose. What can you advise? Thanks.
| 0 |
python,google-app-engine,load-testing
|
2010-12-25T09:37:00.000
| 0 | 4,529,913 |
If you have the budget for it, a professional load testing tool will save you a lot of time and produce more accurate results. Some of those tools handle AJAX apps better than others. I will naturally recommend our product (Web Performance Load Tester) and one of our engineers will help you get it working with your site. You should, of course, evaluate other products to see what works best for your site. Load Impact and Browser Mob are online services that in many cases handle AJAX better than the more traditional tools (except ours!), but they also have downsides.
| 0 | 193 | false | 1 | 1 |
How to test my GAE site for performance
| 4,547,737 |
1 | 4 | 0 | 1 | 1 | 0 | 0.049958 | 1 |
I've checked so many articles, but can't find one for server to server email receiving. I want to write a program or some code just acts as an email receiver, not SMTP server or something else.
Let's suppose I have a domain named example.com, and a gmail user [email protected] sends me an email to [email protected], or a yahoo user [email protected] sends me an email to [email protected]. Now, what do I do to receive this email? I prefer to write this code in Python or Perl.
Regards,
David
| 0 |
python,perl,email
|
2010-12-25T12:58:00.000
| 0 | 4,530,323 |
"reveive" is not a word. I'm really not sure if you mean "receive" or "retrieve".
If you mean "receive" then you probably do want an SMTP server, despite your claim. An SMTP server running on a computer is responsible for listening for network requests from other SMTP servers that wish to deliver mail to that computer.
The SMTP server then, typically, deposits the mail in a directory where it can be read by the recipient. They can usually be configured (often in combination with tools such as Procmail) to do stuff to incoming email (such as pass it to a program for manipulation along the way, this allows you to avoid having to write a full blown SMTP server in order to capture some emails).
If, on the other hand, you mean "retrieve", then you are probably looking to find a library that will let your program act as an IMAP or POP client. These protocols are used to allow remote access to a mailbox.
| 0 | 2,845 | false | 0 | 1 |
How to receive an email on server? Better using Python or Perl
| 4,530,368 |
1 | 2 | 0 | 0 | 4 | 1 | 0 | 0 |
Coming from a Matlab background, I wanted to write small functions in python, and test them individually in the interpreter. However, every time I start the interpreter, I have to import all the modules. In contrast, with matlab all you do is give it the path to the directory and you can execute any matlab function through the interpreter without worrying what to import.
Is there any way the python interpreter could do this?
| 0 |
python,matlab,module,import
|
2010-12-25T16:21:00.000
| 0 | 4,530,763 |
I also consider myself a MATLAB user who is converting to Python. "ipython -pylab" (from a unix shell or mac terminal shell) does a pretty good job of setting up the variables and functions I use for MATLAB-type computing.
Also - although I found it a pain to install on my mac - I like Spyder for its resemblance to the MATLAB IDE. In the Spyder environment - as in MATLAB - you can run scripts (.py files as compared to the .m files in MATLAB) in the interactive window, which can perform the imports. Then you can type interactively into the window, using the functions you imported. As compared to "ipython -pylab" and autoimport, this will allow you to only import the functions/variables that you desire and keep your workspace uncluttered. For now, this may not be of interest, but eventually it could come in handy.
| 0 | 890 | false | 0 | 1 |
Automatically import all modules in the current directory into python interactive interpreter
| 4,531,603 |
1 | 5 | 0 | 0 | 19 | 1 | 0 | 0 |
I'm trying to come up with a good coding problem to ask interview candidates to solve with Python.
They'll have an hour to work on the problem, with an IDE and access to documentation (we don't care what people have memorized).
I'm not looking for a tough algorithmic problem - there are other sections of the interview where we do that kind of thing. The point of this section is to sit and watch them actually write code. So it should be something that makes them use just the data structures which are the everyday tools of the application developer - lists, hashtables (dictionaries in Python), etc, to solve a quasi-realistic task. They shouldn't be blocked completely if they can't think of something really clever.
We have a problem which we use for Java coding tests, which involves reading a file and doing a little processing on the contents. It works well with candidates who are familiar with Java (or even C++). But we're running into a number of candidates who just don't know Java or C++ or C# or anything like that, but do know Python or Ruby. Which shouldn't exclude them, but leaves us with a dilemma: On the one hand, we don't learn much from watching someone struggle with the basics of a totally unfamiliar language. On the other hand, the problem we use for Java turns out to be pretty trivial in Python (or Ruby, etc) - anyone halfway competent can do it in 15 minutes. So, I'm trying to come up with something better.
Surprisingly, Google doesn't show me anyone doing something like this, unless I'm just too dumb to enter the obvious search term. The best idea I've come up with involves scheduling workers to time slots, but it's maybe a little too open-ended. Have you run into a good example? Or a bad one? Or do you just have an idea?
| 0 |
python
|
2010-12-27T01:33:00.000
| 0 | 4,536,195 |
I don't know about Python specifically, but I found that interview questions which involve recursion are a very effective filter. I have asked candidates to produce all the permutations of a string (and think about how to test it), and I have been asked to pseudo-code the Longest Common Subsequence.
| 0 | 46,812 | false | 0 | 1 |
Python coding test problem for interviews
| 4,536,240 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.