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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5
| 5
| 0
| 1
| 1
| 0
| 0.039979
| 1
|
I was looking at a book on python network programming and i wanted to know what would be the benefits to learning python network programming comprehensively? This would be in the context of being able to develop some really cool, ground breaking web apps. I am a python newbe so all opinions woul be appreciated.
Kind Regards
4 Years later:
This was 4yrs ago, its crazy how much I've grown as a developer. Regarding how it has helped, I've developed an email application, a chat application using Objective C, python Twisted on the server side, it also helped with developing my apns push notification pipeline.
| 0
|
python,network-programming
|
2011-03-18T19:49:00.000
| 0
| 5,357,103
|
"python network programming" isn't any special kind of network programming. It sounds like if you had a better grasp on network programming you would be able to see where python would fit in to your overall design. And instead of reading a generic book about it, you would dig through the python API's and go from there.
The cool thing about python is that it's a huge collection of libraries which are optimized to each task. At work we use python to do all our server-side heavy lifting. We then use jquery and the Objective-J based Cappuccino to present an interface to the user.
| 0
| 2,411
| false
| 0
| 1
|
benefits of learning python network programming?
| 5,359,594
|
5
| 5
| 0
| 0
| 1
| 0
| 0
| 1
|
I was looking at a book on python network programming and i wanted to know what would be the benefits to learning python network programming comprehensively? This would be in the context of being able to develop some really cool, ground breaking web apps. I am a python newbe so all opinions woul be appreciated.
Kind Regards
4 Years later:
This was 4yrs ago, its crazy how much I've grown as a developer. Regarding how it has helped, I've developed an email application, a chat application using Objective C, python Twisted on the server side, it also helped with developing my apns push notification pipeline.
| 0
|
python,network-programming
|
2011-03-18T19:49:00.000
| 0
| 5,357,103
|
Python's stronger web tool is definitely Django.
Said that the biggest benefit of learning it is to achieve a pretty robust backend on your web project.
| 0
| 2,411
| false
| 0
| 1
|
benefits of learning python network programming?
| 62,314,047
|
5
| 8
| 0
| -3
| 4
| 0
| -0.07486
| 0
|
What is the role of python for writing dynamic web pages? Does it play an equivalent role to php?
If so, can it do all the same things as php (MySql, file manipulation, sending emails, ...)
| 0
|
php,python
|
2011-03-19T18:18:00.000
| 0
| 5,363,912
|
I think that since go-lang has gone into a release, weekly, tip release cycle, it's starting to show serious stability and it might be worth adding to this conversation. web.go, it's db connections, it's built-in http server, goinstall, ubuntu has packages already. It's website runs on it's include godoc server.
| 0
| 963
| false
| 0
| 1
|
What is the role of python on the internet?
| 5,365,686
|
5
| 8
| 0
| 5
| 4
| 0
| 1.2
| 0
|
What is the role of python for writing dynamic web pages? Does it play an equivalent role to php?
If so, can it do all the same things as php (MySql, file manipulation, sending emails, ...)
| 0
|
php,python
|
2011-03-19T18:18:00.000
| 0
| 5,363,912
|
Everything that is possible in PHP is possible in Python. I'm not sure the opposite is true. And if it is, it would require jumping hoops you don't want to jump through.
Most of the things that are laughingly easy to do in PHP for the web are not so straigtforward to do in Python (by just using the standard library).
As an example making a page with a 3 field form that sends you email without any validation is pretty straightforwared in PHP compared to Python (without any framework).
For less-trivial applications that you build from scratch the numerous Python frameworks and utility libraries for web development will make your life much easier in the long run compared to if you're using anything that exists for PHP.
It's position on the web... Well, facebook is obviously not using it :)
But, companies like Disqus, Quora, Reddit, Digg, NASA and many more use it heavily for web stuff.
There's also lack of cheap (for 5 visits a day) and easy-to-deploy to hosting solutions for python applications. Although that's changing recently.
| 0
| 963
| true
| 0
| 1
|
What is the role of python on the internet?
| 5,364,337
|
5
| 8
| 0
| -2
| 4
| 0
| -0.049958
| 0
|
What is the role of python for writing dynamic web pages? Does it play an equivalent role to php?
If so, can it do all the same things as php (MySql, file manipulation, sending emails, ...)
| 0
|
php,python
|
2011-03-19T18:18:00.000
| 0
| 5,363,912
|
Looks like you don't know the most basic web development uses in Python. Some web frameworks that use Python are:
Django
Flask
Pyramid
Some of the most popular websites also use these frameworks such as Pinterest (which uses Django). EVE was made in stackless python, a form a python used on the web. In conclusion, Python is a very reliable programming language for the web along with Ruby on Rails, Dart, Hack, PHP, Perl, and JavaScript.
EDIT:
Why did I get a reputation of -2?
| 0
| 963
| false
| 0
| 1
|
What is the role of python on the internet?
| 31,680,575
|
5
| 8
| 0
| -1
| 4
| 0
| -0.024995
| 0
|
What is the role of python for writing dynamic web pages? Does it play an equivalent role to php?
If so, can it do all the same things as php (MySql, file manipulation, sending emails, ...)
| 0
|
php,python
|
2011-03-19T18:18:00.000
| 0
| 5,363,912
|
Python's main (only?) limitation compared to PHP is its syntax. Although in most situations it doesn't matter whether you're delimiting statements and blocks with semi-colons and braces (PHP) or line breaks and indentation (Python), this does become a bit of an issue when doing templating. Templating typically requires inserting chunks of code at an indentation level dictated by the surrounding context rather than the embedded code itself. This runs very much against the grain of Python syntax.
There have been some attempts made to create a useful mapping of Python into something that can be injected into templates, but it seems that there is inevitably some loss of expressiveness. Whether the compromise is nonetheless still more powerful than PHP is another matter.
| 0
| 963
| false
| 0
| 1
|
What is the role of python on the internet?
| 5,366,919
|
5
| 8
| 0
| -2
| 4
| 0
| -0.049958
| 0
|
What is the role of python for writing dynamic web pages? Does it play an equivalent role to php?
If so, can it do all the same things as php (MySql, file manipulation, sending emails, ...)
| 0
|
php,python
|
2011-03-19T18:18:00.000
| 0
| 5,363,912
|
Python is a multi purpose language and not limited to the web like PHP.
Numerous web frameworks like Zope, Django or Pylons are build with Python. Apart from that: Php and php-based apps have very bad security record e.g. compared to Zope-based apps.
| 0
| 963
| false
| 0
| 1
|
What is the role of python on the internet?
| 5,364,008
|
1
| 2
| 0
| 0
| 0
| 0
| 0
| 0
|
Folks,
I believe there are two questions I have: one python specific and the other NFS.
The basic point is that my program gets the 'username', 'uid', NFS server IP and exported_path as input from the user. It now has to verify that the NFS exported path is readable/writable by this user/uid.
My program is running as root on the local machine. The straight-forward approach is to 'useradd' a user with the given username and uid, mount the NFS exported path (run as root for mount) on some temporary mount_point and then execute 'su username -c touch /mnt_pt/tempfile'. IF the username and userid input were correct (and the NFS server was setup correctly) this touch of tempfile will succeed creating tempfile on the NFS remote directory. This is the goal.
Now the two questions are:
(i) Is there a simpler way to do this than creating a new unix user, mounting and touching a file to verify the NFS permissions?
(ii) If this is what needs to be done, then I wonder if there are any python modules/packages that will help me execute 'useradd', 'userdel' related commands? I currently intend to use the respective binaries(/usr/sbin/useradd etc) and then invoke subprocess.Popen to execute the command and get the output.
Thank you for any insight.
| 0
|
python,nfs
|
2011-03-20T02:02:00.000
| 1
| 5,366,298
|
There is a python suite to test NFS server functionality.
git://git.linux-nfs.org/projects/bfields/pynfs.git
While it's for NFSv4 you can simply adopt it for v3 as well.
| 0
| 798
| false
| 0
| 1
|
Python: Verifying NFS authentication
| 10,356,745
|
1
| 3
| 0
| 1
| 0
| 1
| 1.2
| 0
|
This one is a little tricky to explain. I would like to create a file, lets say, a .test file. Now, this is ridiculously easy to create and write, but I would like to encode the information so I could only interpret the information with the Test Program.
So, this Test Program would be able to create and read the .test files. And the point is that, only that program can read the file, you can't really interpret the information just by opening the file with Notepad as it wouldn't be read-able.
I would just like some direction as to how I could accomplish this. If you really didn't understand what I just said, I would like to know how to create or how does it work something similar to Bencode used in BitTorrent.
| 0
|
python,encoding,wxpython
|
2011-03-20T21:27:00.000
| 0
| 5,371,632
|
If you want a really simply version, use python's base64 module. The file won't be recognizable opening in notepad anymore, but it'll be easy to decode if you know what you are doing.
If you actually want to prevent any other program from being able to encode it: don't. You can spend a lot of effort and the only thing you can really accomplish is annoying the person who wants the data.
| 0
| 165
| true
| 0
| 1
|
Encoding a file
| 5,371,727
|
1
| 1
| 0
| 0
| 1
| 0
| 1.2
| 0
|
I have been plagued with this problem ever since I started with Python, I want to write a Python script, and then export it as an EXE that I can run on any Windows XP (and up) machine.
cx_Freeze covers all of this perfectly, the only problem is that it required Visual C++ Runtime to be installed on the client computer before the resulting EXE will run on it...
Is it possible to convert my beautiful *.py file into a nice distributable EXE that will run on a fresh install of Windows XP and up?
| 0
|
python,windows,windows-xp,msvcrt,cx-freeze
|
2011-03-21T03:30:00.000
| 1
| 5,373,558
|
AFAIK if you have a Visual Studio licence, you have the right to bundle the appropriate msvcrXY.dll with your application. That will make it run without having to install the runtime files.
If you don't have a Visual Studio licence, I can think of two solutions:
One is to bundle the VS runtime installer with your application (if that is allowed by the licence), and make a tiny batch file/program that runs the installer if necessary, and then your program. This is not ideal if e.g. the user doesn't have admin rights.
The other option I can think of is for you to compile Python with Mingw-gcc, and then use that Python to create your frozen executable. Then it won't depend on the VS runtime libraries. This approach is of course much more complicated and will probably require quite a bit of tinkering. Perhaps someone has already done it though.
| 0
| 746
| true
| 0
| 1
|
Using cx_Freeze (Python 2.7) on a Windows box OOTB
| 5,373,639
|
1
| 4
| 0
| 9
| 3
| 0
| 1
| 0
|
I need know that if a email is sent correctly for to do several operations but the function always return True.
Any idea?
Thanks you.
| 0
|
python,django
|
2011-03-21T07:18:00.000
| 0
| 5,374,818
|
There is no way to check that a mail has actually been received. This is not because of a failing in Django, but a consequence of the way email works.
If you need some form of definite delivery confirmation, you need to use something other than email.
| 0
| 7,759
| false
| 1
| 1
|
How can I know if a email is sent correctly with Django/Python?
| 5,375,529
|
1
| 2
| 0
| 4
| 8
| 1
| 0.379949
| 0
|
I am being told that Python is far superior to C in the ease of programming. I am an average( dont want to praise myself) user of C. Will it be helpful if I learn Python to implement my codes in future?
| 0
|
python,c
|
2011-03-21T11:42:00.000
| 0
| 5,377,123
|
It's always useful to learn another language. If you're familiar with C then I'd invest some time in learning C++ and this is likely to be more immediately useful and will build on your existing skillset, but if you've got the time then learning Python is a great idea!
| 0
| 23,885
| false
| 0
| 1
|
Which is better C Vs Python?
| 5,377,151
|
1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
|
i have quite a lot of experience with python and gst-python, but no experience with plain gstreamer.
does anyone know (well, someone on earth probably does but...) how to create a custom element? i got as far as
class MyElement(Element):
by intuition, but i have no idea what next...
simply what i was hoping for was a "replace this function with the thing you want to happen to every unit that this element is passed", but i am pretty certain that it will be FAR more complicated than that....
| 0
|
python,gstreamer
|
2011-03-21T19:00:00.000
| 0
| 5,382,305
|
If you're creating a source element, you probably want to subclass gst.BaseSrc. Then, IIRC, the main thing you need to do is implement the do_create() virtual method. Don't forget to gobject.type_register() your class; you may also need to set the time format using set_format().
I second the recommendation to look at the Pitivi source code; it contains several GStreamer elements implemented in Python.
| 0
| 1,272
| false
| 0
| 1
|
How to make a custom element im gst-python
| 8,164,493
|
1
| 2
| 0
| 7
| 4
| 1
| 1.2
| 0
|
I have started using Python in a real-time application (serial communication with to gps modules at once), but have found out recently about Lua. Which language would be more suited to the application?
My definition of real-time in this context is the fastest possible time to receive, process and output the data. (Feedback system)
| 0
|
python,lua
|
2011-03-21T20:19:00.000
| 0
| 5,383,145
|
Both are fine languages. Neither should take you years to learn. An easy way to make the decision is to look at what modules are out there already.
For example, you mentioned that your application is related to GPS. Take a look at what libraries are already written to hook Python and Lua into your particular GPS hardware. Maybe someone's already done most of the hard work for you. If not, then go down a step. If you're talking to your GPS over an I2C link, look at I2C libraries in both languages. See which ones are more popular and better maintained.
That said, garbage collected languages have historically had problems with meeting real time requirements. Depending on yours, you may need to go with a lower level language. You should also ensure that whatever system you're running on will support your programming environment. I've worked with systems where Python would have been great but it doesn't fit in 5K of code space.
| 0
| 2,435
| true
| 0
| 1
|
Python or Lua - Realtime application
| 5,383,274
|
1
| 4
| 0
| 2
| 0
| 0
| 0.099668
| 0
|
I'm getting a bunch of .docs emailed to me which I'm writing a python script to extract the body and any .doc or .pdf as well as any message they may have sent and depending on the answer it may do more, and then I want to send it to my web server and have a php script format it for display.
I want to do any converting on my home pc because I don't have shell access to the web server and php is the only language supported which I (kind of) know. On the desktop I'm opened up to python, C, and C++ all of which I know better and are more suited for the job. I would really like to keep the formatting if possible, and I'm not trying to make a big project out of this so if it's too complicated I can always just upload the .doc and open it locally.
| 0
|
c++,python,c,ms-word
|
2011-03-21T22:40:00.000
| 0
| 5,384,599
|
There are various Word to HTML converters - commercial and open source converters. The most common converter (open source) is likely "wv". You can also using Open-Office e.g. using the PyUNO bridge (requires a running OpenOffice server). If you are on Windows there are various commercial solutions available re-using an installed Office installation. In general: Google yourself and choose a converter according to your needs and requirements.
| 0
| 916
| false
| 0
| 1
|
Need an easy way to display a word document in html
| 5,384,992
|
1
| 2
| 0
| 3
| 4
| 1
| 0.291313
| 0
|
What's the best way to temporarily hide an installed module from a python script to test how it handles environments that don't have the module installed?
I'd like to avoid having to uninstall the module just to test.
| 0
|
python,testing,module,import,dependencies
|
2011-03-22T02:51:00.000
| 0
| 5,386,194
|
Change your Python Path.
The order of directories in sys.path shows the order of a search.
You can change sys.path in a test to alter the search order.
| 0
| 88
| false
| 0
| 1
|
Simulating lack of a dependency when testing a python script
| 5,386,248
|
1
| 3
| 0
| 2
| 2
| 0
| 0.132549
| 0
|
I have a webapp with some functionality that I'd like to be made accessible via an API or webservice. My problem is that I want to control where my API can be accessed from, that is, I only want the apps that I create or approve to have access to my API. The API would be a web-based REST service. My users do not login, so there is no authentication of the user. The most likely use case, and the one to work with now, is that the app will be an iOS app. The API will be coded with django/python.
Given that it is not possible to view the source-code of an iOS app (I think, correct me if I'm wrong), my initial thinking is that I could just have some secret key that is passed in as a parameter to the API. However, anyone listening in on the connection would be able to see this key and just use it from anywhere else in the world.
My next though is that I could add a prior step. Before the app gets to use API it must pass a challenge. On first request, my API will create a random phrase and encrypt it with some secret key (RSA?). The original, unencrypted phrase will be sent to the app, which must also encrypt the phrase with the same secret key and send back the encrypted text with their request. If the encryptions match up, the app gets access but if not they don't.
My question is: Does this sound like a good methodology and, if so, are there any existing libraries out there that can do these types of things? I'll be working in python server-side and objective-c client side for now.
| 0
|
python,objective-c,security,api,rsa
|
2011-03-22T17:44:00.000
| 0
| 5,395,588
|
The easiest solution would be IP whitelisting if you expect the API consumer to be requesting from the same IP all the time.
If you want to support the ability to 'authenticate' from anywhere, then you're on the right track; it would be a lot easier to share an encryption method and then requesting users send a request with an encrypted api consumer handle / password / request date. Your server decodes the encrypted value, checks the handle / password against a whitelist you control, and then verifies that the request date is within some timeframe that is valid; aka, if the request date wasnt within 1 minute ago, deny the request (that way, someone intercepts the encrypted value, it's only valid for 1 minute). The encrypted value keeps changing because the request time is changing, so the key for authentication keeps changing.
That's my take anyways.
| 0
| 334
| false
| 1
| 1
|
Security measures for controlling access to web-services/API
| 5,395,647
|
1
| 1
| 0
| 1
| 0
| 1
| 0.197375
| 0
|
My python file has "from .. import" statement to package under C:\Python27\Lib\site-packages.
If my file name does not have any extension (e.g. foo ) then "python foo" works.
If I rename file from foo to foo.py then the "from .. import" statement to that package fails in foo.py:
try:
from my_package.System.prefix import ...
except ImportError:
print "ERROR: Could not import modules."
I have:
PYTHONPATH=C:\Python27\Lib\site-packages
Environment: Windows XP/ Python 2.7
| 0
|
python
|
2011-03-23T01:18:00.000
| 0
| 5,399,827
|
I'm going to make a wild guess here: is your filename the same as the package that you're trying to import (my_package in your example)?
I was able to reproduce behavior similar to what you describe by creating a file, django.py, that contained the import statement from django.db import models. When I ran python django.py, I got ImportError: No module named db. When I moved code to a file named django (without a .py extension), deleted the django.pyc file, and ran python django, the import succeeded.
Why Python tries to import the django module, it starts by looking for a django.py file in the directory that contains the program being executed. In the first case, it imports the django.py file that I created instead of the django module that's installed in site-packages. In the second case, where I renamed my file django, Python can't find a django.py in the same directory as my file, so it properly import django from site-packages.
| 0
| 578
| false
| 0
| 1
|
python file without extension works, but with .py extension fails to import my module
| 5,399,984
|
1
| 2
| 0
| 0
| 2
| 0
| 0
| 0
|
Is there a way to reduce the I/O's associated with either mysql or a python script? I am thinking of using EC2 and the costs seem okay except I can't really predict my I/O usage and I am worried it might blindside me with costs.
I basically develop a python script to parse data and upload it into mysql. Once its in mysql, I do some fairly heavy analytic on it(creating new columns, tables..basically alot of math and financial based analysis on a large dataset). So is there any design best practices to avoid heavy I/O's? I think memcached stores a everything in memory and accesses it from there, is there a way to get mysql or other scripts to do the same?
I am running the scripts fine right now on another host with 2 gigs of ram, but the ec2 instance I was looking at had about 8 gigs so I was wondering if I could use the extra memory to save me some money.
| 1
|
python,mysql,amazon-ec2,mysql-management
|
2011-03-24T20:44:00.000
| 1
| 5,425,289
|
You didn't really specify whether it was writes or reads. My guess is that you can do it all in a mysql instance in a ramdisc (tmpfs under Linux).
Operations such as ALTER TABLE and copying big data around end up creating a lot of IO requests because they move a lot of data. This is not the same as if you've just got a lot of random (or more predictable queries).
If it's a batch operation, maybe you can do it entirely in a tmpfs instance.
It is possible to run more than one mysql instance on the machine, it's pretty easy to start up an instance on a tmpfs - just use mysql_install_db with datadir in a tmpfs, then run mysqld with appropriate params. Stick that in some shell scripts and you'll get it to start up. As it's in a ramfs, it won't need to use much memory for its buffers - just set them fairly small.
| 0
| 202
| false
| 0
| 1
|
reducing I/O on application and database
| 5,426,527
|
1
| 1
| 0
| 2
| 4
| 0
| 1.2
| 0
|
I have a C# module which can be imported into IronPython (well, technically the all can, but one that's meant to be imported). However, the default help used for C# modules by IronPython just isn't sufficient enough.
Is there a way to grab and attach the VS exported xml documentation to a C# module with IronPython's help system? Or is there some way in the C# code to specify what IronPython should put in lieu of the default documentation?
| 0
|
c#,ironpython
|
2011-03-25T03:39:00.000
| 0
| 5,428,298
|
If the XML file is in the same location as the assembly and has the same filename just with ".xml" instead of ".exe" or ".dll" then IronPython should pick it up and include it in relevant doc strings for types, methods, etc...
| 0
| 547
| true
| 0
| 1
|
IronPython use C# module documentation
| 5,439,443
|
1
| 1
| 0
| 2
| 4
| 0
| 0.379949
| 0
|
I am facing a problem here which I could not find a good solution for it. I am developing a mobile web app using php and I need a rule based inference engine (open source) - expert system. The only one I could find was Pyke in Python. So I need to integrate Pykes' source code with my php implementation. My service provider is not allowing any commands such as exec for security reasons. I tried PiP (Python to PHP module) but it has a lot of bugs.
| 0
|
php,python
|
2011-03-25T11:37:00.000
| 0
| 5,431,887
|
I'm not familiar with Pyke; but when this type of situation arises for me, I usually end up wrapping the Python code with a web-service. I then use PHP to make SOAP or cURL calls to the webservice.
| 0
| 1,667
| false
| 1
| 1
|
Python PHP Integration
| 5,433,000
|
1
| 1
| 0
| 1
| 0
| 0
| 1.2
| 0
|
Is it possible to run webservice based on SOAPpy with mod_wsgi under Apache?
if yes can you post link to sample(example)?
| 0
|
python,apache,mod-wsgi,soappy
|
2011-03-25T11:44:00.000
| 0
| 5,431,958
|
No. SOAPpy has its own HTTP server based on BaseHTTPServer which means that it is not possible to turn it into a WSGI app without a non-trivial amount of hacking.
| 0
| 227
| true
| 1
| 1
|
Is it possible to run webservice based on SOAPpy with mod_wsgi under Apache?
| 5,432,043
|
1
| 2
| 0
| 1
| 1
| 0
| 0.099668
| 0
|
I normally web develop in PHP. I am working on a python based project, and want to make a front-end web site for it.
I looked at web.py, and I was wondering if PHP can be used together with web.py, or would I have to rely completely on python as the server side scripting?
Thanks.
| 0
|
python,web.py
|
2011-03-26T18:45:00.000
| 0
| 5,444,445
|
Combining web.py and PHP doesn't really make sense. But you can definitely set up Apache to have both. You just install mod_php and mod_wsgi. Point mod_wsgi to your web.py WSGI function, and set up your PHP web app in some directory where Apache can find it. You won't be combining the two technologies, but you will have separate web applications on your server that separately use the two technologies.
| 0
| 915
| false
| 1
| 1
|
How to run PHP and Web.py together
| 12,962,245
|
1
| 1
| 1
| 2
| 0
| 0
| 1.2
| 0
|
I have some .png images and I want to be able to quickly:
(a) Load a .png from a file.
(b) Draw some simple lines on top of the .png.
(c) Get the contents (bytes) of the resulting image to return as the result of an http request.
It sounds like PIL is a good candidate for doing this with relatively little code. However, I'm trying to understand how efficient it is, especially when I have, say, thousands of lines to draw in step (b). The alternative is using PyOpenGL, but before getting into that I wanted to understand if PIL was already fast enough.
I was going to ask if PIL used OpenGL under the covers. But that might be the wrong question, because my understanding is that to get the real speed benefit from PyOpenGL I'd want to submit my line vertexes as NumPy arrays. So presumably even if PIL uses OpenGL, I'm going to lose a lot of that benefit when I make an individual PIL call to draw each of my lines?
Anybody have concrete data for speed of PIL when drawing lots of primitives?
| 0
|
python,opengl,python-imaging-library,gpu
|
2011-03-27T02:23:00.000
| 0
| 5,446,816
|
"Draw some simple lines on top of the .png" is not a computationally intensive task.
This doesn't seems to be a good candidate for the GPU since they are better suited for more complex tasks. You've got to realize that the image is initially loaded on the RAM, making it your job to send this data to the GPU memory and then retrieve it back. This operation consumes a few milliseconds, depending on the size of the image, that could be better used for CPU processing.
Your application would only benefit from the GPU if it had high arithmetic intensity.
| 0
| 2,486
| true
| 0
| 1
|
How fast is Python Image Library's (PIL) ImageDraw Module, for instance as compared to OpenGL?
| 5,446,952
|
3
| 5
| 0
| 0
| 0
| 1
| 0
| 0
|
I am quite new with development. In some programming language such as python and PHP there is not a good debugger. How is the development going on without a debugger? just put the logs in the source code? Especially for the framework developers, how do they test their codes?
Thank you very much.
-Stefan-
| 0
|
php,python,debugging
|
2011-03-27T05:42:00.000
| 0
| 5,447,482
|
Python has a debugger: pdb. If you use Werkzeug, then you can also access each frame of a stack trace and debug there on an error
| 0
| 94
| false
| 0
| 1
|
How a framework development works without a debugger?
| 5,447,505
|
3
| 5
| 0
| 2
| 0
| 1
| 0.07983
| 0
|
I am quite new with development. In some programming language such as python and PHP there is not a good debugger. How is the development going on without a debugger? just put the logs in the source code? Especially for the framework developers, how do they test their codes?
Thank you very much.
-Stefan-
| 0
|
php,python,debugging
|
2011-03-27T05:42:00.000
| 0
| 5,447,482
|
Your answer concerning the debugging in Python is truly nonsense. Python has a reasonable "pdb" debugger which is useful since years. Apart from that you can have a powerful IDE as WingIDE giving you all debugging and inspection power you need. Making such wild claims about Python is not appropriate. That's why this question deserves a clear downvote.
| 0
| 94
| false
| 0
| 1
|
How a framework development works without a debugger?
| 5,447,522
|
3
| 5
| 0
| 0
| 0
| 1
| 0
| 0
|
I am quite new with development. In some programming language such as python and PHP there is not a good debugger. How is the development going on without a debugger? just put the logs in the source code? Especially for the framework developers, how do they test their codes?
Thank you very much.
-Stefan-
| 0
|
php,python,debugging
|
2011-03-27T05:42:00.000
| 0
| 5,447,482
|
python -m pdb foo.py
And even without using that, usually you get detailed tracebacks when an error happens so many people don't know about pdb because they can just read the error message containing everything they ever wanted to know. It's not like C where it just goes boom and says "Segmentation fault" and leaves you with nothing to work on.
| 0
| 94
| false
| 0
| 1
|
How a framework development works without a debugger?
| 5,452,043
|
1
| 2
| 1
| 0
| 4
| 0
| 0
| 0
|
I have recently converted a library, I originally wrote in C++ with Boost Python wrapping, to C with SWIG wrapping to support more languages.
I switched from C++ to C because the library consists only of a set of functions and I also want the library to be callable from C (without having to compile the whole program with a C++ compiler).
However there is one thing that was not easy to port, a very small subset of the functions needs the ability to report errors back.
In C++/Boost Python that was very elegantly accomplished with throw and exception translation.
What would be the most elegant way (on both the C and wrapped language side) to have a subset of functions report errors?
| 0
|
python,c,swig
|
2011-03-27T09:11:00.000
| 0
| 5,448,257
|
Take a look at Chapter 4 in C Interfaces and Implementations by Richard R. Hanson.
| 0
| 1,235
| false
| 0
| 1
|
Most elegant way for SWIG wrapped C library to raise exceptions
| 5,521,222
|
1
| 1
| 0
| 0
| 0
| 0
| 1.2
| 1
|
I am trying to send an email (through gmail) using python script that someone once wrote on this site, but I'm getting an error:
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe8 in position 2: invalid continuation byte
the script:
import smtplib
from email.mime.text import MIMEText
#mail setup
FROMMAIL = "xxx@gmail.com"
LOGIN = FROMMAIL
PASSWORD = "yyy"
SUBJECT = "test subject"
TOMAIL = "xxx@gmail.com"
msg = MIMEText('testcontent')
msg['Subject'] = 'test'
msg['From'] = FROMMAIL
msg['To'] = TOMAIL
server = smtplib.SMTP('smtp.gmail.com', 587)
server.set_debuglevel(1)
server.ehlo()
server.starttls()
server.login(LOGIN, PASSWORD)
server.sendmail(FROMMAIL, [TOMAIL], msg.as_string())
server.quit()
The stacktrace:
Traceback (most recent call last):
File "C:\Users\xxx\Desktop\test.py", line 11, in
server = smtplib.SMTP('smtp.gmail.com', 587)
File "C:\Program Files\Python31\lib\smtplib.py", line 248, in __init__
fqdn = socket.getfqdn()
File "C:\Program Files\Python31\lib\socket.py", line 290, in getfqdn
name = gethostname()
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe8 in position 2: invalid continuation byte
I am using python v3.1.3.
How to resolve this?
Thank you.
| 0
|
python,email,unicode,gmail,decode
|
2011-03-27T12:03:00.000
| 0
| 5,449,084
|
Use the 'email' module of Python in order to generate proper formatted emails.
Dealing yourself with encoding issues on the application level while composing emails directly through Python is not the way to go.
| 0
| 548
| true
| 0
| 1
|
Python : sending mail through gmail issue
| 5,449,108
|
1
| 4
| 0
| 0
| 4
| 0
| 0
| 1
|
I wanted to know if this was possible- I want to use Python to retweet every tweet a person sends out. If yes then how can I implement this?
| 0
|
python,twitter
|
2011-03-27T12:05:00.000
| 0
| 5,449,091
|
The newest version of python-twitter allows you to retweet with the command
api.PostRetweet(tweet_id)
where api is a logged-in api and tweet_id is the id of the tweet you want to retweet.
| 0
| 4,449
| false
| 0
| 1
|
Sending out twitter retweets with Python
| 16,450,651
|
1
| 2
| 0
| 0
| 3
| 0
| 0
| 0
|
Has anyone tried to compare those python implementations?
pypy
psyco
unladen swallow (is it dead?)
cpython
I am planning to squeeze something more from my server.
Setup:
Django 1.3
Python 2.7
Psycopg2 1.4
apache 2
mod_wsgi
and... Windows server
I am not a windows fanboy, but it has to be :{ There is some legacy code working on it.
| 0
|
python,django,compiler-construction,comparison,benchmarking
|
2011-03-27T18:16:00.000
| 0
| 5,451,246
|
One thing you should considerate is the C extensions. Different implementations require different extension ways. At present, the CTYPES may be the most common one.
So I recommend you take CPython, in case of possible C extensions.
| 0
| 611
| false
| 1
| 1
|
django: on pypy, psyco, unladen swallow or cpython, which one is the fastest?
| 5,497,595
|
1
| 5
| 0
| 0
| 1
| 0
| 0
| 0
|
Looking for a low volume, probably no more that 20-30 users, Open Source message/bulletin board. Obviously must be written in something which our web server supports, PHP/Python/Ruby etc. Any suggestions?
Thanks,
Nick
| 0
|
php,python,html,ruby
|
2011-03-28T13:46:00.000
| 0
| 5,459,896
|
PhpBB is an excellent. It's very easy to set up and has many great features, but it is more difficult to customize right out of the box. For a superfast "community" solution, try using WordPress with the BuddyPress plugin.
| 0
| 462
| false
| 0
| 1
|
Low volume Open source Message Board suggestions?
| 5,460,038
|
1
| 3
| 0
| 1
| 2
| 0
| 0.066568
| 0
|
I am doing research on routing protocols. Currently I perform simulations written in Python of a new protocol. The next step would be to build a real prototype which can really run on top of a Linux-based operating system (as a routing daemon such as ospfd).
What would be a well-suited programming environment/language to quickly build a prototype of a routing protocol? Anyone having experience with building distributed protocol prototypes?
I would like to focus as much as possible on high-level protocol logic instead of on low-level machine-related instructions. I am willing to learn new languages (such as Erlang or Haskell), in case they are better adapted for such a task. Alternatively, I have read about the twisted framework available in Python (which would probably allow to re-use some code), but it is unclear to me if this only would help me in case I write client/server-based protocols.
Does anyone know about an elegant tutorial or example implementation of a (distributed) protocol implementation?
| 0
|
python,routing,network-programming,erlang,protocols
|
2011-03-28T21:00:00.000
| 1
| 5,465,010
|
Erlang is very well suited for just a logical prototype without concrete implementation as well as implementing real world capable implementations of the protocols.
You don't need any other framework, just Erlang and OTP which comes with it is enough.
Even if you have to work down to packet level Erlang helps you with its binary patterns which are gread for working with protocol packets.
Even if you want high performance you can move the most time critical stuff into whats called "Ports" in Erlang implementing it in C or another low level language.
| 0
| 1,573
| false
| 0
| 1
|
Environment for quickly developing routing protocol prototype
| 5,473,481
|
1
| 3
| 0
| 0
| 1
| 0
| 0
| 1
|
in python,can i load a module from remote server to local?
what i do this is want to protect my source code.
what should i do ,thanks
| 0
|
python,module,load
|
2011-03-29T09:04:00.000
| 0
| 5,470,161
|
Yes, you can import your code in creative ways.
No, it will not protect the code from being seen. Rethink your strategy, not tactics.
| 0
| 5,926
| false
| 0
| 1
|
python can load modules from remote server?
| 5,471,112
|
1
| 4
| 0
| 2
| 27
| 1
| 0.099668
| 0
|
I would like to look at the way Python does computes square roots, so I tried to find the definition for math.sqrt(), but I can't find it anywhere. I have looked in _math.c, mathmodule.c, and elsewhere.
I know that python uses C's math functions, but are these somewhere in the Python distribution, or are they linked to code elsewhere? I am using Mac OS X.
Where is the algorithm in math.sqrt()?
| 0
|
python,math,sqrt
|
2011-03-29T17:03:00.000
| 0
| 5,476,189
|
Some modules are written in C and not in python so you wouldn't be able to find the .py files. For a list of these you can use:
import sys
print sys.builtin_module_names
Since it's written in C you will have to find it in the source code. If you have the source already it's in the modules directory.
| 0
| 16,849
| false
| 0
| 1
|
Where can I inspect Python's math functions?
| 5,476,318
|
1
| 1
| 0
| 5
| 7
| 0
| 1.2
| 0
|
Hello How can I enable syntax highlighting for HTML/CSS/JS in Eclipse I am mainly developing in python using the PyDev package but right now I am creating Cheetah templates and they are very hard to read unhighlighted.
Any plugin/package suggestions related to Cheetah or just highlighting any file as html would be greatly appreciated.
thank you.
| 0
|
python,html,eclipse,syntax,cheetah
|
2011-03-29T18:19:00.000
| 0
| 5,477,078
|
Can I somehow trick Eclipse into treating .tmpl files as if they were .html?
It's not a trick.
Under Windows -> Preferences, General -> Editors -> File Associations, you can associate *.tmpl files with your HTML editor.
| 0
| 8,276
| true
| 1
| 1
|
HTML/CSS/JS Syntax Highlighting in Eclipse
| 5,477,725
|
1
| 1
| 0
| 3
| 1
| 0
| 1.2
| 0
|
I have something simple right now, userdb schema is:
userid - autoincrement id email
email address
password
I want to incorporate Facebook and twitter, how would i deal with it on the DB side?
| 0
|
python,database,database-design,login
|
2011-03-30T00:58:00.000
| 0
| 5,480,742
|
You can do this many ways, either you store most of the data in a generic usertable (as you are about to) and the provider details separated.
Or you make a design where you can connect multiple logins to same user. This will end up with something like
id user
id facebookuser (nullable)
id twitteruser (nullable)
This will maybe get you N many e-mail adresses (and still no password! since you arent the provider of the account); or none at all. It depends how much this user trust you in each provider.
Edit:
You might also want to normalize the data without nullables.
You can do this by having
id_user
id_facebookuser id_user
id_twitteruser id_user
| 0
| 105
| true
| 1
| 1
|
Incorporating multiple login systems?
| 5,480,782
|
1
| 3
| 0
| 0
| 0
| 0
| 1.2
| 1
|
Is there a messaging solution out there (preferably supporting Python) that I can use like a mailbox, e.g. retrieve messages from any given queue without having to subscribe? I suppose message queues could work, but I would have to repeatedly subscribe, grab messages from the queue, then unsubscribe, which does not sound optimal.
| 0
|
python,email,scalability,message-queue,messaging
|
2011-03-30T05:05:00.000
| 0
| 5,482,097
|
Most (if not all) Messaging solutions support two modes of messaging
Publish \ Subscribe -that is, you need to subscribe to get the message.
Queuing - one party sends a message to the queue, the other reads the message from the Queue - no subscription needed, and the message is consumed when it's read.
Actually, standard Queuing is more common then publish subscribe - you have better chances of finding a tool that supports queuing, but not pub\sub, then find a tool that supports pub\sub but not queuing.
You are probably looking for the 2nd mode
| 0
| 423
| true
| 0
| 1
|
Protocol for retrieving and publishing messages (message queues without the pub/sub)
| 5,483,282
|
1
| 1
| 0
| 1
| 5
| 1
| 0.197375
| 0
|
I read that mmap is advantageous than fileinput, because it will read a page into kernel pagecache and shares the page in user address space. Whereas, fileinput actually brings a page into kernel and copies a line to user address space. So, there is this extra space overhead with fileinput.
So, I am planning to move to mmap, but I want to know from advanced python hackers whether it improves performance?
If so, is there a similar implementation of fileinput that uses mmap?
Please point me to any opensource code, if you are aware of.
thank you
| 0
|
python,performance
|
2011-03-30T07:20:00.000
| 0
| 5,483,163
|
mmap takes a file and sticks it in RAM so that you can index it like an array of bytes or as a big data structure.
Its a lot faster if you are accessing your file in a "random-access" manner -- that is doing a lot of fseek(), fread(), fwrite() combinations.
But if you are just reading the file in and processing each line once (say), then it is unlikely to be significantly faster. In fact, for any reasonable file size (remember with mmap it all must fit in RAM -- or paging occurs which begins to reduce the efficiency of mmap) it probably is indistinguishable.
| 0
| 2,184
| false
| 0
| 1
|
Advantages of mmap vs fileinput
| 5,506,495
|
1
| 4
| 0
| 1
| 13
| 0
| 0.049958
| 0
|
I have some code written in PHP, but I have also developed a script written in Python. Is it possible to call this Python script from the PHP code?
If yes, how can I pass parameters to the Python script from the PHP?
I have tried to find an answer without any success.
Can someone give me a clue?
| 0
|
php,python
|
2011-03-31T09:11:00.000
| 0
| 5,497,540
|
You can try this:
python scripts:
test.py:
print "hello"
then php Scripts
index.php:
$i =`python test.py`;
echo $i;
| 0
| 43,993
| false
| 0
| 1
|
How to call a Python Script from PHP?
| 45,145,842
|
2
| 3
| 0
| 0
| 1
| 0
| 0
| 1
|
I've got a python crawler crawling a few webpages every few minutes. I'm now trying to implement a user interface to be accessed over the web and to display the data obtained by the crawler. I'm going to use php/html for the interface. Anyway, the user interface needs some sort of button which triggers the crawler to crawl a specific website straight away (and not wait for the next crawl iteration).
Now, is there a way of sending data from the php script to the running python script? I was thinking about standard input/output, but could not find a way this can be done (writing from one process to another process stdin). Then I was thinking about using a shared file which php writes into and python reads from. But then I would need some way to let the python script know, that new data has been written to the file and a way to let the php script know when the crawler has finished its task. Another way would be sockets - but then I think, this would be a bit over the top and not as simple as possible.
Do you have any suggestions to keep everything as simple as possible but still allowing me to send data from a php script to a running python process?
Thanks in advance for any ideas!
Edit: I should note, that the crawler saves the obtained data into a sql database, which php can access. So passing data from the python crawler to the php script is no problem. It's the other way round.
| 0
|
php,python,stdout,stdin,web-crawler
|
2011-03-31T12:06:00.000
| 0
| 5,499,558
|
Since i don't know too much about how python works just treat this like a wild idea.
Create an XML on your server which is accessible by both of python and PHP
On the PHP side you can insert new nodes to this XML about new urls with a processed=false flag
Python come and see for unprocessed tasks then fetch data and put sources onto your db
After successful fetching, toggle the processed flag
When next time PHP touch this XML, delete nodes with processed=true attributes
Hope it helps you in some way.
| 0
| 1,079
| false
| 1
| 1
|
Passing Data to a Python Web Crawler from PHP Script
| 5,499,681
|
2
| 3
| 0
| 1
| 1
| 0
| 0.066568
| 1
|
I've got a python crawler crawling a few webpages every few minutes. I'm now trying to implement a user interface to be accessed over the web and to display the data obtained by the crawler. I'm going to use php/html for the interface. Anyway, the user interface needs some sort of button which triggers the crawler to crawl a specific website straight away (and not wait for the next crawl iteration).
Now, is there a way of sending data from the php script to the running python script? I was thinking about standard input/output, but could not find a way this can be done (writing from one process to another process stdin). Then I was thinking about using a shared file which php writes into and python reads from. But then I would need some way to let the python script know, that new data has been written to the file and a way to let the php script know when the crawler has finished its task. Another way would be sockets - but then I think, this would be a bit over the top and not as simple as possible.
Do you have any suggestions to keep everything as simple as possible but still allowing me to send data from a php script to a running python process?
Thanks in advance for any ideas!
Edit: I should note, that the crawler saves the obtained data into a sql database, which php can access. So passing data from the python crawler to the php script is no problem. It's the other way round.
| 0
|
php,python,stdout,stdin,web-crawler
|
2011-03-31T12:06:00.000
| 0
| 5,499,558
|
Best possible way to remove dependencies of working with different languages is to use a message queuing library (like rabbitMQ or ActiveMQ)
By using this you can send direct messages from php to python or vice versa...
If you want an easy way out you need to modify your python script(more on the lines of what fabrik said) to poll a database(or a file) for any new jobs...and process it if it finds one...
| 0
| 1,079
| false
| 1
| 1
|
Passing Data to a Python Web Crawler from PHP Script
| 5,500,025
|
3
| 3
| 0
| 7
| 7
| 1
| 1.2
| 0
|
How easy is it to reverse engineer an auto-generated C code? I am working on a Python project and as part of my work, am using Cython to compile the code for speedup purposes.
This does help in terms of speed, yet, I am concerned that where I work, some people would try to "peek" into the code and figure out what it does.
Cython code is basically an auto-generated C. Is it very hard to reverse engineer it?
Are there any recommendations that would make the code safer and reverse-engineering harder to do? (I assume that with enough effort, everything can be reversed engineered).
| 0
|
python,c,reverse-engineering,cython
|
2011-03-31T23:18:00.000
| 0
| 5,507,531
|
Okay -- to attempt to answer your question more directly: most auto-generated C code is fairly ugly, so somebody would need to be fairly motivated to reverse engineer it. At the same time, I don't believe I've never looked at what Cython generates, so I'm not sure how it looks.
In addition, a lot of auto-generated code is done in the form of things like state machine tables, that most programmers find fairly difficult to follow even at best. The tendency (in many cases) is to have a generic framework, with tables of data that the framework more or less "interprets" at run-time. This isn't necessarily impossible to follow, but it's enough different from most typical code that most people will give up on it fairly quickly (and if they do much, they'll typically waste a lot of time looking at the framework instead of the data, which is what really matters in cases like this).
I'll repeat, however, that I'm pretty sure I haven't looked at what Cython produces, so I can't say much about it with any real certainty.
There are (or at least used to be) commercial obfuscators intended to make C source code difficult to understand. I suspect the availability of Perl has taken a lot of the market share from them, but if you look you may still be able to find one and use it.
Absent that, it's not terribly difficult to write an obfuscator of your own, but the degree of effectiveness will probably vary with the amount of effort you're willing to put into it. Just systematically renaming any meaningful variable names into things like _ and __ can do quite a bit (e.g., profit = sales - costs; is a lot more meaningful than _ = _I_ - _i_;). Depending on the machine generated code in question, however, this may not really accomplish much -- obfuscating a generic framework may not make much difference in understanding what your code does -- and if they figure out the procedure you're following, they may be able to simply replicate the correct framework code and transplant the pieces specific to your program into the un-obfuscated framework.
| 0
| 2,870
| true
| 0
| 1
|
Reverse Engineer Auto-Generated C?
| 5,507,763
|
3
| 3
| 0
| 2
| 7
| 1
| 0.132549
| 0
|
How easy is it to reverse engineer an auto-generated C code? I am working on a Python project and as part of my work, am using Cython to compile the code for speedup purposes.
This does help in terms of speed, yet, I am concerned that where I work, some people would try to "peek" into the code and figure out what it does.
Cython code is basically an auto-generated C. Is it very hard to reverse engineer it?
Are there any recommendations that would make the code safer and reverse-engineering harder to do? (I assume that with enough effort, everything can be reversed engineered).
| 0
|
python,c,reverse-engineering,cython
|
2011-03-31T23:18:00.000
| 0
| 5,507,531
|
You should really take a look at the code that Cython produces. To help with debugging, for example, it copies the complete Python source code into the generated file, marking each source line before generating C code for it. That makes it very easy to find the code section that you are interested in.
A very nice feature is that you can compile your code with the "-a" (annotate) option, and it will spit out an HTML file next to the C file that contains the annotated Python code. When you click on a line, you'll see the C code for that line. As a bonus, it marks lines that do a lot of Python processing in dark yellow, so that you get a simple indicator where to look for potential optimisations.
There's also special gdb support in Cython now, so you can do Cython source level debugging etc.
| 0
| 2,870
| false
| 0
| 1
|
Reverse Engineer Auto-Generated C?
| 5,687,219
|
3
| 3
| 0
| 2
| 7
| 1
| 0.132549
| 0
|
How easy is it to reverse engineer an auto-generated C code? I am working on a Python project and as part of my work, am using Cython to compile the code for speedup purposes.
This does help in terms of speed, yet, I am concerned that where I work, some people would try to "peek" into the code and figure out what it does.
Cython code is basically an auto-generated C. Is it very hard to reverse engineer it?
Are there any recommendations that would make the code safer and reverse-engineering harder to do? (I assume that with enough effort, everything can be reversed engineered).
| 0
|
python,c,reverse-engineering,cython
|
2011-03-31T23:18:00.000
| 0
| 5,507,531
|
Ah, I guess I missed the bit that you were talking about the compiled module, whereas I was only referring to the source code that Cython generates. I agree with Jerry that it will be fairly tricky to extract something useful from the compiled module, as long as you keep the gdb support disabled (the default) and strip the debugging symbols. That is because the C compiler will do lots of inlining of helper functions all over the place and apply various low-level code optimisations, thus making it harder to extract the original macro level code patterns. However, you will see named C-API calls to CPython, and you will also see function names from your own code. Cython isn't specifically designed for code obfuscation, quite the opposite. But readable assembly has certainly never been a design goal.
| 0
| 2,870
| false
| 0
| 1
|
Reverse Engineer Auto-Generated C?
| 5,687,328
|
1
| 9
| 0
| 1
| 16
| 0
| 0.022219
| 0
|
C++ has a set of functions, ffs(), ffsl(), and ffsll(), that return the least significant bit that is set in a given binary integer.
I'm wondering if there is an equivalent function already available in Python. I don't see one described for bitarray, but perhaps there's another. I am hoping to avoid calculating the answer by looping through all possible bit masks, though of course that's an option of last resort; ffs() simply returns a single integer and I'd like to know of something comparable in Python.
| 0
|
python,bit-manipulation
|
2011-04-02T02:10:00.000
| 0
| 5,520,655
|
It's a little silly to try and aggressively optimize Python code, so a simple for loop with counter and right-shift should be fine. If you wanted to go faster (which would make more sense in C, Java, or Assembly) you could binary-search for the right-most 1-bit and even use lookup tables to help you.
Suppose x is 64-bits and you want the LSB. Mask off the lower 32-bits. Assume x is nonzero:
if x & 0xffffffff == 0:
if x & 0xffff00000000 == 0:
# the LSB is in the highest two bytes
else:
# the LSB is in the 5th or 6th byte
else:
if x & 0xffff0000:
# the LSB is in the 3rd or 4th byte
else:
# the LSB is in the 1st or 2nd byte
How you handle the commented section above depends on how aggressive you want to be: you could do further binary searching analogous to what we have, or you could use a lookup table. As it stands, we have 16-bits of uncertainty, so our table would be 65,536 entries. I have actually made tables like this for extremely performance-sensitive code, but that was a C program that played Chess (the 64-bit string there was a binary representation of the board).
| 0
| 14,720
| false
| 0
| 1
|
return index of least significant bit in Python
| 5,520,784
|
4
| 4
| 0
| 0
| 0
| 1
| 0
| 0
|
The question is quite clear, ... note however that I am NOT asking about a feature comparison (there are a lot of them already), nor am I asking about which one you prefer !
I have myself a clear preference for doctests, I use them for everything, even if those are not to be used for documentation. But what I am wondering is : is there anything you can do with unitests that you cannot do with doctests ???
| 0
|
python,unit-testing,doctest
|
2011-04-02T09:23:00.000
| 0
| 5,522,334
|
Some tests will need things like databases set up and initialised.
This could make doctests:
very verbose (and therefore not good
documentation); and
probably inefficient because in doctests you would typically set
up the database for each function or class. In comparison,
unit tests more easily could use the
same database to test many functions
or classes.
| 0
| 370
| false
| 0
| 1
|
Python: Does 'unittest' have something that 'doctest' hasn't?
| 5,523,349
|
4
| 4
| 0
| 0
| 0
| 1
| 0
| 0
|
The question is quite clear, ... note however that I am NOT asking about a feature comparison (there are a lot of them already), nor am I asking about which one you prefer !
I have myself a clear preference for doctests, I use them for everything, even if those are not to be used for documentation. But what I am wondering is : is there anything you can do with unitests that you cannot do with doctests ???
| 0
|
python,unit-testing,doctest
|
2011-04-02T09:23:00.000
| 0
| 5,522,334
|
Doctests are limited to per function (or per class) tests. You cannot do things like taking the output of one function and trying it with another etc. It's best used for "example" type tests (i.e. how do I use this function?)
Unit tests can be larger and more involved than doctests.
| 0
| 370
| false
| 0
| 1
|
Python: Does 'unittest' have something that 'doctest' hasn't?
| 5,522,673
|
4
| 4
| 0
| 6
| 0
| 1
| 1
| 0
|
The question is quite clear, ... note however that I am NOT asking about a feature comparison (there are a lot of them already), nor am I asking about which one you prefer !
I have myself a clear preference for doctests, I use them for everything, even if those are not to be used for documentation. But what I am wondering is : is there anything you can do with unitests that you cannot do with doctests ???
| 0
|
python,unit-testing,doctest
|
2011-04-02T09:23:00.000
| 0
| 5,522,334
|
There is a widespread misconception that doctest is for testing your code. doctest is intended for testing your documentation. doctest is intended to test that your documentation matches what the function/class/module is actually doing, and alerts you if sample code in your documentation becomes obsolete as the module evolves.
While doctest might reveal bugs in the code, it is not its primary purpose (e.g. like a change in code might unravel bugs in a unittest's testcase code, but testing the testcase code is not unitetest's primary purpose)
even if those are not to be used for documentation
docstring are automatically extracted out by help() function to become documentation for your
function/class/module; you cannot make a docstring not a documentation. Users of your module/function/class (or you in a few days) might try to do help() on your function/class/module and get a surprise that the documentation is a bunch of codes.
| 0
| 370
| false
| 0
| 1
|
Python: Does 'unittest' have something that 'doctest' hasn't?
| 5,522,962
|
4
| 4
| 0
| 3
| 0
| 1
| 1.2
| 0
|
The question is quite clear, ... note however that I am NOT asking about a feature comparison (there are a lot of them already), nor am I asking about which one you prefer !
I have myself a clear preference for doctests, I use them for everything, even if those are not to be used for documentation. But what I am wondering is : is there anything you can do with unitests that you cannot do with doctests ???
| 0
|
python,unit-testing,doctest
|
2011-04-02T09:23:00.000
| 0
| 5,522,334
|
There are some test scenarios doctests simply don't cover very well. That's OK since, as Lie pointed out, doctests aren't meant to be a comprehensive testing solution - they're meant to ensure that simple interactive-prompt style examples in your documentation (including docstrings) don't get out of date.
Writing actual unit tests, on the other hand, allows you to unlimber the full power of Python in deciding how to compose your test suite (e.g. using inheritance to share not only test set up and tear down operations, but also actual test methods).
doctests may be a part of that, but they aren't a complete testing solution (except for small, relatively self-contained operations).
It's probably worth browsing Python's own test suite (the test package) and taking a look at some of the tests in there. While doctests play their part, most of it is written using unittest.
| 0
| 370
| true
| 0
| 1
|
Python: Does 'unittest' have something that 'doctest' hasn't?
| 5,523,855
|
1
| 6
| 0
| 2
| 14
| 1
| 0.066568
| 0
|
What is the equivalent of template context in Pyramid?
Does the IBeforeRender event in pyramid have anything to with this? I've gone through the official documentation but diffcult to understand what the IBeforeRender event is exactly.
| 0
|
python,pylons,pyramid
|
2011-04-02T13:51:00.000
| 0
| 5,523,546
|
It seems to me, that the solutions above do not exactly copy the behavior of Pylons template context. If one renders a page request in Pylons and adds some value a to the context c, it is accessible in the template as c.a. However, if one renders another request, this key/value will be dropped.
The Pyramid solutions above show another behavior. the key/value c.a will stay in the template context. Sometimes, this is not desired. Are there any suggestions to fix this difference?
| 0
| 2,766
| false
| 0
| 1
|
Equivalent of template context in Pyramid (pylons user)
| 8,312,263
|
1
| 4
| 0
| 14
| 30
| 1
| 1
| 0
|
I've got a python script that outputs unicode to the console, and I'd like to redirect it to a file. Apparently, the redirect process in python involves converting the output to a string, so I get errors about inability to decode unicode characters.
So then, is there any way to perform a redirect into a file encoded in UTF-8?
| 0
|
python,unicode,console
|
2011-04-03T16:02:00.000
| 0
| 5,530,708
|
Set the environment variable PYTHONIOENCODING to the encoding you want before redirecting a python script to a file. Then you won't have to modify the original script. Make sure to write Unicode strings as well, otherwise PYTHONIOENCODING will have no effect. If you write byte strings, the bytes are sent as-is to the terminal (or redirected file).
| 0
| 7,460
| false
| 0
| 1
|
Can I redirect unicode output from the console directly into a file?
| 5,531,730
|
1
| 2
| 0
| 3
| 13
| 1
| 0.291313
| 0
|
Suppose I'd like to run a python script like this: python my_script.py MY_INPUT.
In this case, MY_INPUT will be transmitted to sys.argv[1].
Is there a limit to the number of characters MY_INPUT can contain?
Is there a limit to the type of characters MY_INPUT can contain?
Any other limitations with regards to MY_INPUT?
UPDATE: I am using Ubuntu Linux 10.04
| 0
|
python
|
2011-04-04T01:18:00.000
| 1
| 5,533,704
|
Python itself doesn't impose any limitations on the length or content of sys.argv. However, your operating system and/or command shell definitely will. This question cannot be completely answered without detailed consideration of your operating environment.
| 0
| 11,527
| false
| 0
| 1
|
python sys.argv limitations?
| 5,533,719
|
1
| 3
| 0
| 1
| 4
| 0
| 0.066568
| 0
|
Say we have project that requires web scraping. (parsing strings (< 40) and scraping web pages (geting meta datas and such)
I am aware of that perl has great and suited cpan modules for this job, so i can take that way and don't bother myself that much. But i don't have a clue about speed and memory related stuff.
So, which would you choose? (May be Python??) And in terms of speed which one is better for this job? Explain please...
Thanks in advance.
| 0
|
php,python,perl,performance,web-scraping
|
2011-04-04T12:24:00.000
| 0
| 5,538,386
|
I would go with perl... I haired a rumor that was the language that google used initially... Python is a good performance language as well.
| 0
| 2,213
| false
| 0
| 1
|
Perl vs PHP to web scraping
| 5,538,463
|
1
| 8
| 0
| 0
| 30
| 1
| 0
| 0
|
How does boost.python deal with Python 3? Is it Python 2 only?
| 0
|
c++,python,boost,python-3.x,boost-python
|
2011-04-04T13:58:00.000
| 0
| 5,539,557
|
In my case adding "Using Python : 3 etc." into user-config.jam in my home directory didn't work. I had to add the line into project-config.jam instead, which resides in the root directory of unpacked boost.
Specifically the line was:
using python : 3.9 : /usr/bin/python3 : /usr/include/python3.9 : /usr/lib ;
and the version of boost was 1_78_0
| 0
| 44,365
| false
| 0
| 1
|
Boost and Python 3.x
| 71,157,876
|
2
| 2
| 1
| 7
| 3
| 0
| 1.2
| 0
|
I am a great python fan. Recently I got an idea to write RTS engine and/or maybe a simple RTS game based upon this engine. There are a couple of things I need to think about and maybe you can give me some advice on these:
Performance. Most games are written in C++. Isn't python too slow for game engine? I am aiming only at 2D, but still it may be too demnading.
Graphics. Are there any good graphics libraries for python? SDL/OpenGL bindings or maybe something more suitable for python?
Game engines. Do you know of any existing RTS engine written in python?
Any tools/libraries for python that maybe helpful in developing RTS
Thanks in advance!
| 0
|
python,performance,graphics,real-time-strategy
|
2011-04-04T21:36:00.000
| 0
| 5,544,634
|
Performance may be an issue with heavy graphics/math processing. If so, see Panda3D, NumPy, Cython, and PyPy.
Use Pyglet, PyOpenGL with Pyglet, Panda3D (although you are writing in 2D, you can still use a 3D engine), or perhaps some other library.
There don't seem to be existing RTS libraries, but there are definitely pre-existing generalized engines.
Try searching for RTS-related libraries in general: you'll need AI, pathfinding, networking, and so on. Therefore, you may be interested in Twisted, for instance, since it helps with networking.
| 0
| 2,553
| true
| 0
| 1
|
2D RTS in Python?
| 5,544,725
|
2
| 2
| 1
| 3
| 3
| 0
| 0.291313
| 0
|
I am a great python fan. Recently I got an idea to write RTS engine and/or maybe a simple RTS game based upon this engine. There are a couple of things I need to think about and maybe you can give me some advice on these:
Performance. Most games are written in C++. Isn't python too slow for game engine? I am aiming only at 2D, but still it may be too demnading.
Graphics. Are there any good graphics libraries for python? SDL/OpenGL bindings or maybe something more suitable for python?
Game engines. Do you know of any existing RTS engine written in python?
Any tools/libraries for python that maybe helpful in developing RTS
Thanks in advance!
| 0
|
python,performance,graphics,real-time-strategy
|
2011-04-04T21:36:00.000
| 0
| 5,544,634
|
I can answer your first two.
Python isn't too slow for games. That all games must be written in C++ is a myth. Sure C++ (or C) might give you the best performance, but it doesn't mean you're unable to write a game in another language.
Try PyGame: SDL bindings for Python.
| 0
| 2,553
| false
| 0
| 1
|
2D RTS in Python?
| 5,544,672
|
2
| 7
| 0
| 0
| 137
| 1
| 0
| 0
|
How can I ignore .pyc files in git?
If I put it in .gitignore it doesn't work. I need them to be untracked and not checked for commits.
| 0
|
python,git
|
2011-04-05T11:45:00.000
| 0
| 5,551,269
|
if you have committed in the repo, just
go to the folder /__pycache__,
delete all of them (no worries, they are temporary files and generated repeatedly)
have a new commit, such as 'update gitignore'
you are done! .pyc will not appear again.
| 0
| 164,905
| false
| 0
| 1
|
Ignore .pyc files in git repository
| 67,986,868
|
2
| 7
| 0
| 94
| 137
| 1
| 1
| 0
|
How can I ignore .pyc files in git?
If I put it in .gitignore it doesn't work. I need them to be untracked and not checked for commits.
| 0
|
python,git
|
2011-04-05T11:45:00.000
| 0
| 5,551,269
|
You have probably added them to the repository before putting *.pyc in .gitignore.
First remove them from the repository.
| 0
| 164,905
| false
| 0
| 1
|
Ignore .pyc files in git repository
| 5,551,629
|
1
| 2
| 0
| 1
| 0
| 0
| 0.099668
| 0
|
I have a Python command line script that connects to a database, generates files from the data and sends e-mails. I already have some unit-tests for the important components. Now I'd like to do tests that use several or all components together, load the test database with sample data and check for the correct output.
Are there Python libraries that support this kind of testing? Specifically, I'm looking for easy ways to
put sample data in the database
check for specific changes in the database
check for existence and content of specific files
Should I even do these tests in Python or should I just write a bunch of shell scripts?
| 0
|
python,shell,integration-testing
|
2011-04-05T15:33:00.000
| 0
| 5,554,429
|
Yes. The unittest libraries can be used for this.
Don't be fooled by the name. A "unit" is not always a single, standalone class (or function).
A "unit" can be a composite "unit" of one or more classes or modules or packages.
| 0
| 522
| false
| 0
| 1
|
How to do integration tests for a Python script?
| 5,554,478
|
1
| 5
| 0
| 1
| 5
| 1
| 0.039979
| 0
|
I very like the "battery included" philosophy of Python but now I have to perform a slim installation with only core features and some other which I'd like to choose one by one.
Is it possible to download Python with only selected modules?
| 0
|
python,distribution
|
2011-04-06T16:13:00.000
| 0
| 5,569,652
|
AFAIK it's not possible to download Python with only selected modules, but after an install you can remove everything (read: the libraries) you don't need (never going to use JSON? Gone!, etc).
| 0
| 287
| false
| 0
| 1
|
Get Python without (selected) batteries
| 5,569,750
|
1
| 2
| 0
| 0
| 2
| 0
| 0
| 1
|
For the work I am currently doing I need similar functionality as Bittorrent, only difference is I need to do some sort of extra analysis on every block received by client from peers. Though I am fairly new with Python, I found official Bittorrent client source code easy to understand (as compared to Transmission's C source code). But I can't seem to figure out the part in the source code where it deals/handles every block received.
It'd be great if anyone, who is acquainted with Bittorrent official client source code (or Transmission), can provide me some pointers for the same.
| 0
|
python,c,bittorrent
|
2011-04-07T09:42:00.000
| 0
| 5,579,047
|
For Transmission, try looking at libtransmission/peer-mgr.c for code specific to each type of message received from a particular peer. This file represents the peer manager and all communication with it.
It uses libtransmission/peer-msgs.c for handling the exact messages.
| 0
| 168
| false
| 0
| 1
|
Block handling in bittorent
| 5,582,728
|
2
| 3
| 0
| 1
| 2
| 0
| 0.066568
| 0
|
I've been coding php for years, and now i have to finally make my own project, and i want it very optimized and shiny. So, i've been searching around the net about which programming language should i use for my needs (fast, secure, easy-understandable, customizable) and all points to -> Python. So I decided to go on, but i just can't feel "home" when writing python (inc Django app...). I got used to PHP's syntax, and my IDE (PHP Expert Editor 4.3) makes php look awesome, so now i just can't go with python.
Maybe there is something which has php's syntax (let's say per example: Perl)...but the advantages of a high-level programming language (aka Python)?
| 0
|
php,python
|
2011-04-07T14:08:00.000
| 0
| 5,582,450
|
If you've been coding in PHP for years, then maybe PHP is still the right choice for you? As long as your project is related to web (by the way Facebook uses PHP!) you should stick to it.
Python is really easy and fun to learn, but as any other programming language - it requires time to get into it. And for web projects, you'll have to catch up with frameworks and maybe servers (e.g. tornado).
If you'd like to do something on enterprise level, Java is also a good choice. But never as easy and as fun as Python :)
| 0
| 155
| false
| 0
| 1
|
From PHP to Python accommodation
| 5,582,849
|
2
| 3
| 0
| 2
| 2
| 0
| 0.132549
| 0
|
I've been coding php for years, and now i have to finally make my own project, and i want it very optimized and shiny. So, i've been searching around the net about which programming language should i use for my needs (fast, secure, easy-understandable, customizable) and all points to -> Python. So I decided to go on, but i just can't feel "home" when writing python (inc Django app...). I got used to PHP's syntax, and my IDE (PHP Expert Editor 4.3) makes php look awesome, so now i just can't go with python.
Maybe there is something which has php's syntax (let's say per example: Perl)...but the advantages of a high-level programming language (aka Python)?
| 0
|
php,python
|
2011-04-07T14:08:00.000
| 0
| 5,582,450
|
This line of work requires you to adjust to different syntaxes (even in PHP alone you need to know sql and js and Css and html too...).
So the answer is no, there is nothing like what you ask, and you better get used to that :-)
b.t.w is Python really faster than PHP?
| 0
| 155
| false
| 0
| 1
|
From PHP to Python accommodation
| 5,582,510
|
1
| 2
| 0
| -3
| 1
| 0
| -0.291313
| 1
|
How can I make a PHP 5.3 webserver using Python?
I know how to make a simple HTTP server, but how can I include PHP?
Thanks.
| 0
|
php,python
|
2011-04-08T06:20:00.000
| 0
| 5,591,230
|
After some clarifications at last it came clear that your question was
"how to connect PHP to HTTP server"
So, actually you were interested in three letters: CGI.
However I still doubt you will get any good from it.
| 0
| 1,908
| false
| 0
| 1
|
PHP Webserver in Python
| 5,591,381
|
1
| 1
| 0
| 0
| 0
| 0
| 1.2
| 0
|
I'm trying to use distutils with a Python module that contains extensions written in C. The program code is housed on a Linux server, but I sometimes upload changes from a Windows machine using the file transfer program WinSCP (editing is done in Notepad++). I've noticed that distutils often does not notice these changes in the C code (i.e. python setup.py build does not trigger gcc if the code was previously compiled). A check of the C source code on the server shows that it really has been updated correctly. On the other hand, changing the code directly on the server using a text editor like vim always causes python setup.py build to recompile the changed files. Any idea why uploading changed files might not cause distutils to recompile them?
Thanks.
EDIT:
After investigating this further I am noticing the same problem if I just create a plain C program with a Makefile. Thus this problem does not look like it is a distutils problem.
| 0
|
python,distutils
|
2011-04-08T18:39:00.000
| 1
| 5,599,414
|
Looking into the source for distutils and seeing how it enforces rebuilds it looks like it checks timestamps of files to determine whether a file is out of date or not.
Can you make sure the timestamp is changing when winscp is uploading the file? Otherwise it looks like the build command has a "force" option that forces a rebuild no matter what.
| 0
| 938
| true
| 0
| 1
|
distutils does not recompile C extension modules
| 5,599,557
|
3
| 4
| 0
| 0
| 9
| 1
| 0
| 0
|
I'm probably doing something really dumb here, but it's driving me crazy.
I have two PyDev projects in Eclipse. One project, 'Analysis' depends on the other, 'PyCommon'. I'm 100% sure of this as when I look at the project references for Analysis, PyCommon is checked, and automatic import/code completion works when I reference elements in PyCommon from Analysis.
I'm trying to write/run a module in Analysis. The module is fhb/analysis/log_parsers.py.
I'm trying to import the element OrderStatus from fhb/pycommon/types/order_status in the PyCommon project. So, my import statement is
'from fhb.pycommon.types.order_status import OrderStatus'
PyDev clearly knows where this is because that import statement was written automatically by PyDev on a quickfix correction. Nonetheless, when I try to run the main function in log_parsers.py, I get this:
Traceback (most recent call last):
File "/workspace/Analysis/src/fhb/analysis/log_parsers.py", line 6, in
from fhb.pycommon.types.order_type import OrderType
ImportError: No module named pycommon.types.order_status
All of these packages are under a proper source folder ('src') in each project.
Also, even though Analysis absolutely is set to reference PyCommon , when I look under PyDev-PYTHONPATH in Analysis's properties, only Analysis's own src folder appears under the 'Source Folder' tab, and it's the only project I see if I click on 'Add source folder'
| 0
|
python,module,import,dependencies,pydev
|
2011-04-08T22:51:00.000
| 0
| 5,601,566
|
I believe you have to add the path of PyCommon into PYTHONPATH or else it won't be able to find the actual modules to import.
| 0
| 5,179
| false
| 0
| 1
|
Can't import module from dependent project in PyDev
| 5,637,508
|
3
| 4
| 0
| 2
| 9
| 1
| 0.099668
| 0
|
I'm probably doing something really dumb here, but it's driving me crazy.
I have two PyDev projects in Eclipse. One project, 'Analysis' depends on the other, 'PyCommon'. I'm 100% sure of this as when I look at the project references for Analysis, PyCommon is checked, and automatic import/code completion works when I reference elements in PyCommon from Analysis.
I'm trying to write/run a module in Analysis. The module is fhb/analysis/log_parsers.py.
I'm trying to import the element OrderStatus from fhb/pycommon/types/order_status in the PyCommon project. So, my import statement is
'from fhb.pycommon.types.order_status import OrderStatus'
PyDev clearly knows where this is because that import statement was written automatically by PyDev on a quickfix correction. Nonetheless, when I try to run the main function in log_parsers.py, I get this:
Traceback (most recent call last):
File "/workspace/Analysis/src/fhb/analysis/log_parsers.py", line 6, in
from fhb.pycommon.types.order_type import OrderType
ImportError: No module named pycommon.types.order_status
All of these packages are under a proper source folder ('src') in each project.
Also, even though Analysis absolutely is set to reference PyCommon , when I look under PyDev-PYTHONPATH in Analysis's properties, only Analysis's own src folder appears under the 'Source Folder' tab, and it's the only project I see if I click on 'Add source folder'
| 0
|
python,module,import,dependencies,pydev
|
2011-04-08T22:51:00.000
| 0
| 5,601,566
|
I think pydev is having trouble with similar package names near the root of the package name "fhb". I'm having the same problem. Removing the packages in one of the projects let me reference the other one without a problem.
I couldn't solve the problem, but I think it has to do with the root folder of the package being the same.
| 0
| 5,179
| false
| 0
| 1
|
Can't import module from dependent project in PyDev
| 16,126,724
|
3
| 4
| 0
| 0
| 9
| 1
| 0
| 0
|
I'm probably doing something really dumb here, but it's driving me crazy.
I have two PyDev projects in Eclipse. One project, 'Analysis' depends on the other, 'PyCommon'. I'm 100% sure of this as when I look at the project references for Analysis, PyCommon is checked, and automatic import/code completion works when I reference elements in PyCommon from Analysis.
I'm trying to write/run a module in Analysis. The module is fhb/analysis/log_parsers.py.
I'm trying to import the element OrderStatus from fhb/pycommon/types/order_status in the PyCommon project. So, my import statement is
'from fhb.pycommon.types.order_status import OrderStatus'
PyDev clearly knows where this is because that import statement was written automatically by PyDev on a quickfix correction. Nonetheless, when I try to run the main function in log_parsers.py, I get this:
Traceback (most recent call last):
File "/workspace/Analysis/src/fhb/analysis/log_parsers.py", line 6, in
from fhb.pycommon.types.order_type import OrderType
ImportError: No module named pycommon.types.order_status
All of these packages are under a proper source folder ('src') in each project.
Also, even though Analysis absolutely is set to reference PyCommon , when I look under PyDev-PYTHONPATH in Analysis's properties, only Analysis's own src folder appears under the 'Source Folder' tab, and it's the only project I see if I click on 'Add source folder'
| 0
|
python,module,import,dependencies,pydev
|
2011-04-08T22:51:00.000
| 0
| 5,601,566
|
Your problem may come from __init__.py being missing from some of your module folders.
For your example, for using OrderStatus from order_status.py in fhb.pycommon.types.order_status, you need to have a (possibly empty) __init__.py file in fhb, fhb/pycommon, and fhb/pycommon/types.
Also note that for pylint to work correctly for fhb/analysis/log_parsers.py, you need to have an __init__.py in fhb/analysis as well.
| 0
| 5,179
| false
| 0
| 1
|
Can't import module from dependent project in PyDev
| 24,829,182
|
1
| 2
| 0
| 3
| 0
| 1
| 1.2
| 0
|
How can i change character encoding of a string to UTF-8? I am making some execv calls to a python program but python returns the strings with the some characters cut of. I don't know if this a python issue or c issue but i thought if i can change the strings encoding in c and then pass it to python, it should do the trick. So how can i do that?
Thanks.
| 0
|
python,c,encoding
|
2011-04-10T20:07:00.000
| 0
| 5,614,372
|
C as a language does not facilitate string encoding. A C string is simply a null-terminated sequence of characters (8-bit signed integers, on most systems).
A wide string (with characters of type wchar_t, typically 16-bit integers) can also be used to hold larger character values; however, again, C standard library functions and data types are in no way aware of any concept of string encoding.
The answer to your question is to ensure that the strings you're passing into Python are encoded as UTF-8.
In order to help you accomplish that in any detailed capacity, however, you will have to provide more information about how your strings are currently formed, what they contain, and how you're constructing your argument list for exec.
| 0
| 1,560
| true
| 0
| 1
|
How to change a strings encoding as utf 8 in C
| 5,614,405
|
1
| 8
| 0
| 2
| 18
| 0
| 0.049958
| 0
|
I would need to run a python script for some random amount of time, pause it, get a stack traceback, and unpause it. I've googled around for a way to do this, but I see no obvious solution.
| 0
|
python,profile,stochastic
|
2011-04-11T03:15:00.000
| 0
| 5,616,446
|
To implement an external statistical profiler for Python, you're going to need some general debugging tools that let you interrogate another process, as well as some Python specific tools to get a hold of the interpreter state.
That's not an easy problem in general, but you may want to try starting with GDB 7 and the associated CPython analysis tools.
| 0
| 3,341
| false
| 0
| 1
|
Is there a statistical profiler for python? If not, how could I go about writing one?
| 5,616,811
|
1
| 1
| 0
| 2
| 1
| 0
| 1.2
| 0
|
One can send messages to an AT&T customer via [10-digit-cell-numer]@txt.att.net from their email client. I tried to send a file to my iPhone using this method (specifically an audio file) to no avail. The message came through but the file attachment was not present.
| 0
|
python,email,scripting,mms
|
2011-04-11T23:25:00.000
| 0
| 5,628,715
|
It seems you can send MMS messages to @mms.att.net
That was easy.
| 0
| 1,545
| true
| 0
| 1
|
Sending file via email to MMS for ATT
| 5,628,773
|
3
| 4
| 0
| 5
| 63
| 1
| 0.244919
| 0
|
I would like to access R from within a Python program. I am aware of Rpy2, pyrserve and PypeR.
What are the advantages or disadvantages of these three options?
| 0
|
python,r,rpy2,pyrserve,pyper
|
2011-04-12T04:32:00.000
| 0
| 5,630,441
|
in pyper, i can't pass large matrix from python to r instance with assign(). however, i don't have issue with rpy2.
it is just my experience.
| 0
| 18,829
| false
| 0
| 1
|
How do Rpy2, pyrserve and PypeR compare?
| 13,636,318
|
3
| 4
| 0
| 5
| 63
| 1
| 0.244919
| 0
|
I would like to access R from within a Python program. I am aware of Rpy2, pyrserve and PypeR.
What are the advantages or disadvantages of these three options?
| 0
|
python,r,rpy2,pyrserve,pyper
|
2011-04-12T04:32:00.000
| 0
| 5,630,441
|
From a developer's prospective, we used to use rpy/rpy2 to provide statistical and drawing functions to our Python-based application. It has caused huge problems in delivering our application because rpy/rpy2 needs to be compiled for specific combinations of Python and R, which makes it infeasible for us to provide binary distributions that work out of box unless we bundle R as well. Because rpy/rpy2 are not particularly easy to install, we ended up replacing relevant parts with native Python modules such as matplotlib. We would have switched to pyrserve if we had to use R because we could start a R server locally and connect to it without worrying about the version of R.
| 0
| 18,829
| false
| 0
| 1
|
How do Rpy2, pyrserve and PypeR compare?
| 28,990,370
|
3
| 4
| 0
| 40
| 63
| 1
| 1.2
| 0
|
I would like to access R from within a Python program. I am aware of Rpy2, pyrserve and PypeR.
What are the advantages or disadvantages of these three options?
| 0
|
python,r,rpy2,pyrserve,pyper
|
2011-04-12T04:32:00.000
| 0
| 5,630,441
|
I know one of the 3 better than the others, but in the order given in the question:
rpy2:
C-level interface between Python and R (R running as an embedded process)
R objects exposed to Python without the need to copy the data over
Conversely, Python's numpy arrays can be exposed to R without making a copy
Low-level interface (close to the R C-API) and high-level interface (for convenience)
In-place modification for vectors and arrays possible
R callback functions can be implemented in Python
Possible to have anonymous R objects with a Python label
Python pickling possible
Full customization of R's behavior with its console (so possible to implement a full R GUI)
MSWindows with limited support
pyrserve:
native Python code (will/should/may work with CPython, Jython, IronPython)
use R's Rserve
advantages and inconveniences linked to remote computation and to RServe
pyper:
native Python code (will/should/may work with CPython, Jython, IronPython)
use of pipes to have Python communicate with R (with the advantages and inconveniences linked to it)
edit: Windows support for rpy2
| 0
| 18,829
| true
| 0
| 1
|
How do Rpy2, pyrserve and PypeR compare?
| 5,643,423
|
1
| 1
| 0
| 1
| 0
| 0
| 1.2
| 0
|
I have an Android appthat originally posted some strings in json format to a python cgi script, which all worked fine. The problem is when the json object contains lists, then python (Using simplejson) when it gets them is still treating them as a big string
Here is a text dump of the json once it reaches python before I parse it:
{"Prob1":"[1, 2, 3]","Name":"aaa","action":1,"Prob2":"[20, 20, 20]","Tasks":"[1 task, 2 task, 3 task]","Description":""}
if we look at the "Tasks" key, the list after is clearly a single string with the elements all treated as one string (i.e. no quotes around each element). it's the same for prob1 and prob2. action, Name etc are all fine. I'm not sure if this is what python is expecting but I'm guessing not?
Just in case the android data was to blame i added quotes around each element of the arraylist like this:
Tasks.add('"'+row.get(1).toString()+'"'); instead of Tasks.add(row.get(1).toString());
On the webserver it's now received as
{"Prob1":"[1, 2, 3]","Name":"aaa","action":1,"Prob2":"[20, 20, 20]","Tasks":"[\"1 task\", \"2 task\", \"3 task\"]","Description":""}
but i still get the same problem; when i iterate through "Tasks" in a loop it's looping through each individual character as if the whole thing were a string :/
Since I don't know what the json structure should look like before it gets to Python I'm wondering whether it's a probem with the Android sending the data or my python interpreting it.. though from the looks of that script I've been guessing it's been the sending.
In the Android App I'm sending one big JSONObject containing "Tasks" and the associated arraylist as one of the key value pairs... is this correct? or should JSONArray be involved anywhere?
Thanks for any help everyone, I'm new to the whole JSON thing as well as to Android/Java (And only really a novice at Python too..). I can post additional code if anyone needs it, I just didn't want to lengthen the post too much
EDIT:
when I add
json_data=json_data.replace(r'"[','[')
json_data=json_data.replace(r']"',']')
json_data=json_data.replace(r'\"','"')
to the python it WORKS!!!! but that strikes me as a bit nasty and just papering over a crack..
| 0
|
python,android,json
|
2011-04-12T05:41:00.000
| 0
| 5,630,870
|
Tasks is just a big string. To be a valid list, it would have to be ["1 task", "2 task", "3 task"]
Same goes for Prob1 and Prob2. To be a valid list, the brackets should not be enclosed in quotes.
| 0
| 439
| true
| 0
| 1
|
Python grabbing JSON from POST method
| 5,630,896
|
1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
|
I'm using a Digi 3G router that can be programmed with python, and I want it to make periodic SSH connections to another device. I've read everything about paramiko, but don't know how to install it in the router.
I want to know if there is any other way of including paramiko into a device, apart from installing (i.e. including some library), or if it exist another possibility apart from paramiko for this particular case.
Thanks in advance.
| 0
|
python
|
2011-04-12T13:47:00.000
| 0
| 5,636,251
|
The description for the Digi 3G states that it is capable of python scripting, using a custom development environment. To make this work, you would have to use the python source code from paramiko; the executable would not be installable directly on the router (since the executable is designed to be run on a computer, not a router).
The source code would probably have to be modified, since the APIs for this sort of thing are most likely different than those in a computer, and the router would have to be capable of what you are asking of it.
| 0
| 202
| false
| 0
| 1
|
SSH connection with python from a device (not computer)
| 5,639,270
|
2
| 4
| 0
| 2
| 23
| 0
| 0.099668
| 1
|
I'm venturing in unknown territory here...
I am trying to work out how hard it could be to implement an Email client using Python:
Email retrieval
Email sending
Email formatting
Email rendering
Also I'm wondering if all protocols are easy/hard to support e.g. SMTP, IMAP, POP3, ...
Hopefully someone could point me in the right direction :)
| 0
|
python,email,smtp,imap,email-client
|
2011-04-13T10:08:00.000
| 0
| 5,647,487
|
If I were you, I'd check out the source code of existing email-clients to get an idea: thunderbird, sylpheed-claws, mutt...
Depending on the set of features you want to support, it is a big project.
| 0
| 40,032
| false
| 0
| 1
|
How hard is it to build an Email client? - Python
| 5,647,584
|
2
| 4
| 0
| 8
| 23
| 0
| 1
| 1
|
I'm venturing in unknown territory here...
I am trying to work out how hard it could be to implement an Email client using Python:
Email retrieval
Email sending
Email formatting
Email rendering
Also I'm wondering if all protocols are easy/hard to support e.g. SMTP, IMAP, POP3, ...
Hopefully someone could point me in the right direction :)
| 0
|
python,email,smtp,imap,email-client
|
2011-04-13T10:08:00.000
| 0
| 5,647,487
|
I think you will find much of the clients important parts prepackaged:
Email retrieval - I think that is covered by many of the Python libraries.
Email sending - This would not be hard and it is most likely covered as well.
Email formatting - I know this is covered because I just used it to parse single and multipart emails for a client.
Email rendering - I would shoot for an HTML renderer of some sort. There is a Python interface to the renderer from the Mozilla project. I would guess there are other rendering engines that have python interfaces as well. I know wxWidgets has some simple HTML facilities and would be a lot lighter weight. Come to think about it the Mozilla engine may have a bunch of the other functions you would need as well. You would have to research each of the parts.
There is lot more to it than what is listed above. Like anything worth while it won't be built in a day. I would lay out precisely what you want it to do. Then start putting together a prototype. Just build a simple framework that does basic things. Like only have it support the text part of a message with no html. Then build on that.
I am amazed at the wealth of coding modules available with Python. I needed to filter html email messages, parse stylesheets, embed styles, and whole host of other things. I found just about every function I needed in a Python library somewhere. I was especially happy when I found out that some css sheets are gzipped that there was a module for that!
So if you are serious about then dig in. You will learn a LOT. :)
| 0
| 40,032
| false
| 0
| 1
|
How hard is it to build an Email client? - Python
| 6,868,304
|
1
| 1
| 0
| 1
| 1
| 0
| 0.197375
| 0
|
I am working on a realtime data website that has a data-mining backend side to it. I am highly experienced in both Python and C++/C#, and wondering which one would be preferable for the backend development.
I am strongly leaning towards Python for its available libraries and ease of use. But am I wrong? If so, why?
As I side question, would you recommend using SQLAlchemy? Are there any drawback to it (performance is crucial) compared to _mysql or MySQLdb?
Thanks!
| 1
|
c#,c++,python,backend
|
2011-04-14T04:27:00.000
| 0
| 5,658,529
|
We do backend development based on Zope, Python and other Python-related stuff since almost 15 years. Python gives you great flexibility and all-batteries included (likely true for C#, not sure about C++).
If you do RDBMS development with Python: SQLAlchemy is the way to go. It provides a huge functionality and saved my a** over the last years a couple of times...Sqlalchemy can be complex and complicated but the advantages is that you can hide a complex database schema behind an OO facade..very handy like any ORM in general.
_mysql vs MySQLdb...I only know of the python-mysql package.
| 0
| 1,302
| false
| 0
| 1
|
Designing a Website Backend - Python or C++/C#?
| 5,658,631
|
1
| 2
| 0
| 2
| 3
| 0
| 0.197375
| 0
|
I'm currently creating a website using PHP and the Kohana framework. I want to site to be able to use real time (or near real time) data (e.g. for chat and real time feeds). I need it to be able to scale to thousands of concurrent users. I've done a lot of reading and still have no idea what the best method is for this.
Does anyone have any experience with StreamHub? Is it possible to use this with PHP?
Am I digging myself into a hole here and need to switch languages? I've looked at node js and nowjs, but I'm weary about coding a while site in Express (I wonder about security holes, code maintainability, lack of a good ORM). I've read about Twisted Python, but have no idea what web framework would work well on top of that, and I'd prefer not to use Nevow - maybe Django can be used well with Twisted Python? I'm just looking to be pointed in the right direction, so I don't go too far in PHP and realize I can't get the near real-time results that I need.
Thanks for the help.
| 0
|
php,python,node.js,real-time
|
2011-04-14T13:46:00.000
| 0
| 5,664,225
|
I've looked at node js and nowjs, but
I'm weary about coding a while site in
Express (I wonder about security
holes, code maintainability, lack of a
good ORM).
I can personally vouch for code maintainability if you can do JavaScript. I personally find JavaScript more maintainable then PHP but that's probably due to lack of PHP experience.
ORM is not an issue as node.js favours document based databases. Document based databases and JSON go hand in hand, I find couch db and it's map/reduce system easy to use and it feels natural with json.
In terms of security holes, yes a node.js server is young and there may be holes. These are un avoidable. There are currently no known exploits and I would say it's not much more vulnerable
then IIS/apache/nginx until someone points a big flaw.
I want to site to be able to use real
time (or near real time) data (e.g.
for chat and real time feeds). I need
it to be able to scale to thousands of
concurrent users.
Scalability like that requires non-blocking IO. This requires a non-blocking IO server likes nginx or node.js (Yes blocking IO could work but you need so much more hardware).
Personally I would advice using node.js over PHP as it's easier to write non blocking IO in node. You can do it in PHP but you have to make all the right design and architecture decisions. I doubt there are any truly async non-blocking PHP frameworks.
Python's twisted / Ruby's EventMachine together with nginx, can work but I have no expertise with those. At least with node you can't accidentally call a blocking library or make use of the native blocking libraries since JavaScript has no native IO.
| 0
| 1,845
| false
| 1
| 1
|
Creating a real time website using PHP
| 5,664,340
|
2
| 3
| 0
| 1
| 2
| 0
| 0.066568
| 0
|
I've been searching for an IDE with code completion (intellisence) for IronPython on Linux systems (typically Ubuntu).
I've found references to MonoDevelop and Eclipse (PyDev) supporting IronPython, but I can't get any of them to work.
Is this because MonoDevelop and PyDev only support IronPython code completion on Windows? Are there any installation guides that I could follow to make these IDEs work on Ubuntu / Linux.
Many thanks for your help,
Chris
| 0
|
linux,ide,ironpython,monodevelop,pydev
|
2011-04-14T14:08:00.000
| 1
| 5,664,513
|
I don't know about Eclipse, but there isn't currently an IronPython addin for MonoDevelop. If anyone's interested in developing one, please contact the MonoDevelop mailing list for advice on getting started.
| 0
| 2,128
| false
| 0
| 1
|
IronPython IDE for Ubuntu and Linux
| 5,667,841
|
2
| 3
| 0
| 2
| 2
| 0
| 0.132549
| 0
|
I've been searching for an IDE with code completion (intellisence) for IronPython on Linux systems (typically Ubuntu).
I've found references to MonoDevelop and Eclipse (PyDev) supporting IronPython, but I can't get any of them to work.
Is this because MonoDevelop and PyDev only support IronPython code completion on Windows? Are there any installation guides that I could follow to make these IDEs work on Ubuntu / Linux.
Many thanks for your help,
Chris
| 0
|
linux,ide,ironpython,monodevelop,pydev
|
2011-04-14T14:08:00.000
| 1
| 5,664,513
|
Try JetBrains PyCharm
| 0
| 2,128
| false
| 0
| 1
|
IronPython IDE for Ubuntu and Linux
| 5,883,279
|
2
| 3
| 0
| 1
| 5
| 0
| 0.066568
| 0
|
I am trying to load a *.pyd with Python, but I receive the well known "Import Error: DLL load failed: the specified procedure can not be found." error.
I have already done the following:
1.) Investigated the *.pyd with Dependency Walker. GPSVC.DLL and IESHIMS.DLL came up as missing, but delay loaded, IEFRAME.DLL aslo came up as missing an export, but was also delay-loaded. It's my understanding that these are not used, and are delay load anyway, so they should not be the problem.
2.) Did an "import foo" on foo.pyd in the python command window, with ProcMon watching. ProcMon shows event "LoadImage" on "foo.pyd" with result SUCCESS.
This seems to imply that the *.pyd file loaded correctly.
So what am I missing. My windows diagnostics are telling me all is well, but python is telling me the thing cannot be loaded (usually due to a missing dll or symbol).
Ideas?
Thanks!
| 0
|
python,dll,procmon,pyd
|
2011-04-14T18:05:00.000
| 0
| 5,667,556
|
Ok here is the answer:
The windows diagnostics (depends, procmon, etc) were showing the DLL (or pyd) loading fine.
Python was showing that it was not loading fine.
I found that the windows tools were referring to a different Python26.dll hiding in my C:\Window\SysWOW64 folder.
This second Python26.dll (found in SysWOW64) has a symbol that is missing in the primary python26.dll (installed by the windows python installer, found in C:\Python26).
This symbol "_PyByteArray_empty_string", was apparently needed by my *.pyd file.
So when loading via windows diagnostics, the SysWOW64 dll was found, and the *.pyd loaded properly. When loading from python, the dll in C:\Python26\ was found, the symbol was missing, and load failed.
So that is WHY the problem manifested. The question now is: Why are there two versions of Python26.dll floating around, one with _PyByteArray_empty_string, and one without?
I'm using Python 2.6.6. Perhaps this symbol is removed in 2.6.6 but present in some older 2.6.x release?
| 0
| 9,402
| false
| 0
| 1
|
*.pyd file fails to load, but DependancyWalker comes up clean, and ProcMon shows it loaded
| 5,687,105
|
2
| 3
| 0
| 5
| 5
| 0
| 1.2
| 0
|
I am trying to load a *.pyd with Python, but I receive the well known "Import Error: DLL load failed: the specified procedure can not be found." error.
I have already done the following:
1.) Investigated the *.pyd with Dependency Walker. GPSVC.DLL and IESHIMS.DLL came up as missing, but delay loaded, IEFRAME.DLL aslo came up as missing an export, but was also delay-loaded. It's my understanding that these are not used, and are delay load anyway, so they should not be the problem.
2.) Did an "import foo" on foo.pyd in the python command window, with ProcMon watching. ProcMon shows event "LoadImage" on "foo.pyd" with result SUCCESS.
This seems to imply that the *.pyd file loaded correctly.
So what am I missing. My windows diagnostics are telling me all is well, but python is telling me the thing cannot be loaded (usually due to a missing dll or symbol).
Ideas?
Thanks!
| 0
|
python,dll,procmon,pyd
|
2011-04-14T18:05:00.000
| 0
| 5,667,556
|
Is the .pyd file for the same version of Python you're using? Loading a .pyd file for the wrong Python version can produce that error message.
Dependency Walker can show you which pythonNN.dll it links to.
| 0
| 9,402
| true
| 0
| 1
|
*.pyd file fails to load, but DependancyWalker comes up clean, and ProcMon shows it loaded
| 5,669,041
|
3
| 4
| 0
| 1
| 3
| 0
| 0.049958
| 0
|
I hi have just ordered a couple of beaglboards for experimenting. I know that it can rub Ubuntu and many other flavors of linux.
Does that mean it can run all the trivial software that run on Ubuntu?
Will the python and ruby interpreters work just the way they work on PC ?
| 0
|
python,ruby,beagleboard
|
2011-04-14T21:14:00.000
| 1
| 5,669,785
|
The interpreters do not need to be compiled from source, as the Ubuntu arm distribution has python in its repository as a deb. I was able to write my python scripts on my Ubuntu box and transfer them to the beagleboard without any changes. Performance so far has been surprisingly good, as I'm using the python script as a bridge between the real-time sound processing/synthesis language supercollider and a motor control board that communicates over USB-serial.
| 0
| 3,513
| false
| 0
| 1
|
Can beagleboard run python or Ruby programs?
| 6,601,437
|
3
| 4
| 0
| 4
| 3
| 0
| 1.2
| 0
|
I hi have just ordered a couple of beaglboards for experimenting. I know that it can rub Ubuntu and many other flavors of linux.
Does that mean it can run all the trivial software that run on Ubuntu?
Will the python and ruby interpreters work just the way they work on PC ?
| 0
|
python,ruby,beagleboard
|
2011-04-14T21:14:00.000
| 1
| 5,669,785
|
The Beagleboard can run both of them, but you may have to compile the interpreters from source. And don't expect the performance of a desktop.
| 0
| 3,513
| true
| 0
| 1
|
Can beagleboard run python or Ruby programs?
| 5,669,819
|
3
| 4
| 0
| 1
| 3
| 0
| 0.049958
| 0
|
I hi have just ordered a couple of beaglboards for experimenting. I know that it can rub Ubuntu and many other flavors of linux.
Does that mean it can run all the trivial software that run on Ubuntu?
Will the python and ruby interpreters work just the way they work on PC ?
| 0
|
python,ruby,beagleboard
|
2011-04-14T21:14:00.000
| 1
| 5,669,785
|
The Angstrom Linux distribution (which runs on the Beagle Board) has binary packages for both Python and Ruby. I've worked on an application that uses Python and PyGTK. Never had any problems.
| 0
| 3,513
| false
| 0
| 1
|
Can beagleboard run python or Ruby programs?
| 8,717,516
|
3
| 3
| 0
| 2
| 4
| 0
| 0.132549
| 0
|
Fabric is a tool for "executing local or remote shell commands."
Why would you re-implement a remote shell script line by line in a long Fabric script?
That is, why not just write a brief Fabric script that runs a long remote shell script instead?
| 0
|
python,shell,deployment,fabric
|
2011-04-15T06:31:00.000
| 1
| 5,673,154
|
Also, I think the path you'd choose would depend on what you're trying to do. Some things are easier in python (write it in your fabfile), while others are easier in shell-land (take one of the shell approaches mentioned).
Either way, fabric is geared towards centralization and portability, and it doesn't really matter what's actually doing the lifting.
| 0
| 1,058
| false
| 0
| 1
|
Why re-implement shell commands line by line in a Fabric script?
| 8,855,653
|
3
| 3
| 0
| 4
| 4
| 0
| 0.26052
| 0
|
Fabric is a tool for "executing local or remote shell commands."
Why would you re-implement a remote shell script line by line in a long Fabric script?
That is, why not just write a brief Fabric script that runs a long remote shell script instead?
| 0
|
python,shell,deployment,fabric
|
2011-04-15T06:31:00.000
| 1
| 5,673,154
|
It wont be a good idea if I have to run the same script on, lets say, 10 servers. This means I've to not only stick the same long script on 10 servers, but also make sure if I change it on 1 server, the change has to be applied to all servers. I know this can be averted by keeping that script on a shared location, but its much more organized to have the script in the fabfile, which can not only be version controlled but kept uniform across all the roles.
| 0
| 1,058
| false
| 0
| 1
|
Why re-implement shell commands line by line in a Fabric script?
| 5,674,298
|
3
| 3
| 0
| 4
| 4
| 0
| 1.2
| 0
|
Fabric is a tool for "executing local or remote shell commands."
Why would you re-implement a remote shell script line by line in a long Fabric script?
That is, why not just write a brief Fabric script that runs a long remote shell script instead?
| 0
|
python,shell,deployment,fabric
|
2011-04-15T06:31:00.000
| 1
| 5,673,154
|
lobster1234 raises a good point that you don't want to have to manually stick a long, remote shell script on 10 servers. However, if you still want to avoid rewriting the long, remote shell script as a long Fabric script, you could write a Fabric script that copies that remote shell script to the designated server, executes that script, and then removes the script. This way you can revision control both the fabfile and shell script together but avoid rewriting the shell script into a Fabric script.
| 0
| 1,058
| true
| 0
| 1
|
Why re-implement shell commands line by line in a Fabric script?
| 5,676,599
|
2
| 2
| 0
| 2
| 0
| 0
| 0.197375
| 0
|
Chef is commonly used for provisioning servers, right? So is LibCloud, right?
What's an example use case of why someone would use both tools together?
| 0
|
python,deployment,chef-infra
|
2011-04-15T07:22:00.000
| 1
| 5,673,599
|
I use chef to bootstrap ec2 instances. I also use boto to do further modifications of ec2 instances such as creating tags etc. I will be now be using libcloud more often since I will I will have a mix between rackspace and ec2.
As a side, when bootstrap a ec2 or rackspace instance, I do not use knife, I use libcload to boot a machine and ssh into into machine and install chef client since I fond it to be more reliable and even faster then knife by 3-5 minutes.
Net net, both are used together. Its a happy marriage.
| 0
| 739
| false
| 0
| 1
|
Example of using Chef with LibCloud
| 10,241,015
|
2
| 2
| 0
| 0
| 0
| 0
| 0
| 0
|
Chef is commonly used for provisioning servers, right? So is LibCloud, right?
What's an example use case of why someone would use both tools together?
| 0
|
python,deployment,chef-infra
|
2011-04-15T07:22:00.000
| 1
| 5,673,599
|
Chef works with a variety of cloud computing providers:
Amazon AWS EC2
Rackspace Cloud
Terremark vCloud
Bluebox Group
Openstack
Slicehost
It does this through the Ruby library, fog.
| 0
| 739
| false
| 0
| 1
|
Example of using Chef with LibCloud
| 5,919,135
|
2
| 3
| 0
| 1
| 20
| 1
| 0.066568
| 0
|
I'm in the process of redesigning/refactoring my Python quantum chemistry package (pyquante). One of the things I don't like about the existing release is that I have to install the package to run the test suite. That is, the test suite has statements like from PyQuante import SCF, and, of course, this PyQuante could refer to the installed version or a local version.
I know about virtualenv, and realize this is an option for me. But I was wondering whether anything else might be appropriate. In the past I've hacked sys.path for things like this, and have been told by better Python programmers that I shouldn't ever to this.
Does anyone have any suggestions for how I can do this? The point is that I want to test the current version of the code without installing it.
Thanks in advance for anyone who can see through my babbling and offer suggestions!
| 0
|
python,testing
|
2011-04-15T13:54:00.000
| 0
| 5,677,809
|
Altering sys.path much in production environment may be unwise. Altering it for testing is usually OK.
If you don't want to tinker with the variable from sys, use an environment variable named PYTHONPATH, it's a clean and documented way.
| 0
| 10,868
| false
| 0
| 1
|
How can I test my python module without installing it
| 5,677,921
|
2
| 3
| 0
| 6
| 20
| 1
| 1
| 0
|
I'm in the process of redesigning/refactoring my Python quantum chemistry package (pyquante). One of the things I don't like about the existing release is that I have to install the package to run the test suite. That is, the test suite has statements like from PyQuante import SCF, and, of course, this PyQuante could refer to the installed version or a local version.
I know about virtualenv, and realize this is an option for me. But I was wondering whether anything else might be appropriate. In the past I've hacked sys.path for things like this, and have been told by better Python programmers that I shouldn't ever to this.
Does anyone have any suggestions for how I can do this? The point is that I want to test the current version of the code without installing it.
Thanks in advance for anyone who can see through my babbling and offer suggestions!
| 0
|
python,testing
|
2011-04-15T13:54:00.000
| 0
| 5,677,809
|
I would honestly insist on using virtualenv, its designed for this exact reason in mind. very small overhead, and if you ever mess up just delete directory. I am sure as you grow, things won't be as simple as they are now for your current situation. Take it as an opportunity to learn.
| 0
| 10,868
| false
| 0
| 1
|
How can I test my python module without installing it
| 5,678,267
|
1
| 2
| 0
| 0
| 1
| 0
| 0
| 0
|
We have around 250 identical linux server which runs a business critical web application for a bank. Basically we do a lot of scripting work but now i want to centralize that only in one location. That means run on one server and and deploy it in many. I know you guys must be thinking that this is an easy task and can be done with a shell script. But again we need to create many different different scripts to do our work
I know python has a big library and this can be possible but i dont know how. To cut in short i need all scripts in one file and based on the argument it will execute it according.
For example in a python program we have a function where we can mix them to perform different result.
So you please let me know how to go about it
| 0
|
python,django,linux,fabric
|
2011-04-15T15:44:00.000
| 1
| 5,679,203
|
You could also try any of the distributed computing packages. Pyro is one of them that might interest you.
| 0
| 304
| false
| 0
| 1
|
Python scripting in linux
| 5,680,308
|
2
| 4
| 0
| 2
| 16
| 1
| 0.099668
| 0
|
I'd like to start developing an existing Python module. It has a source folder and the setup.py script to build and install it. The build script just copies the source files since they're all python scripts.
Currently, I have put the source folder under version control and whenever I make a change I re-build and re-install. This seems a little slow, and it doesn't settle well with me to "commit" my changes to my python install each time I make a modification. How can I cause my import statement to redirect to my development directory?
| 0
|
python
|
2011-04-15T15:56:00.000
| 0
| 5,679,359
|
Install the distrubute package then use the developer mode. Just use python setup.py develop --user and that will place path pointers in your user dir location to your workspace.
| 0
| 4,136
| false
| 0
| 1
|
Developing Python Module
| 5,679,488
|
2
| 4
| 0
| 0
| 16
| 1
| 0
| 0
|
I'd like to start developing an existing Python module. It has a source folder and the setup.py script to build and install it. The build script just copies the source files since they're all python scripts.
Currently, I have put the source folder under version control and whenever I make a change I re-build and re-install. This seems a little slow, and it doesn't settle well with me to "commit" my changes to my python install each time I make a modification. How can I cause my import statement to redirect to my development directory?
| 0
|
python
|
2011-04-15T15:56:00.000
| 0
| 5,679,359
|
Change the PYTHONPATH to your source directory. A good idea is to work with an IDE like ECLIPSE that overrides the default PYTHONPATH.
| 0
| 4,136
| false
| 0
| 1
|
Developing Python Module
| 5,679,437
|
1
| 2
| 0
| 0
| 0
| 0
| 0
| 0
|
I have an embedded linux device and here's what I would like to do using python:
Get the device console over serial port. I can do it like this:
>>> ser = serial.Serial('/dev/ttyUSB-17', 115200, timeout=1)
Now I want to run a tail command on the embedded device command line, like this:
# tail -f /var/log/messages
and capture the o/p and display on my python >>> console.
How do I do that ?
| 0
|
python,serial-port
|
2011-04-17T00:22:00.000
| 1
| 5,690,599
|
very first you need to get log-in into the device.
then you can run the specified command on that device.
note:command which you are going to run must be supported by that device.
Now after opening a serial port using open() you need to find the login prompt using Read() and then write the username using write(), same thing repeat for password.
once you have logged-in you can now run the commands you needed to execute
| 0
| 4,870
| false
| 0
| 1
|
how to read command output from serial device using python
| 23,190,516
|
1
| 2
| 0
| 2
| 2
| 0
| 0.197375
| 1
|
I am looking for a Twitter Streaming API Python library with proxy support. I love tweepy, but unfortunately I haven't seen a way to use an HTTP proxy. Any ideas?
| 0
|
python,api,twitter,proxy,streaming
|
2011-04-18T08:29:00.000
| 0
| 5,700,302
|
Tweepy uses httplib internally which is too low level to have proxy settings. You have to change Stream._run() method to connect to proxy instead of target host and use full (with scheme and host) URL in request.
| 0
| 1,810
| false
| 0
| 1
|
Twitter Streaming API Python library with proxy support?
| 5,755,092
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.