Search Results

Search found 15187 results on 608 pages for 'boost python'.

Page 50/608 | < Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >

  • Converting a bash script to python (small script)

    - by Mestika
    Hi, I’ve a bash script I’ve been using for a Linux environment but now I have to use it on a Windows platform and want to convert the bash script to a python script which I can run. The bash script is rather simple (I think) and I’ve tried to convert it by google by way around but can’t convert it successfully. The bash script looks like this: runs=5 queries=50 outfile=outputfile.txt date >> $outfile echo -e "\n---------------------------------" echo -e "\n----------- Normal --------------" echo -e "\n---------------------------------" echo -e "\n----------- Normal --------------" >> $outfile for ((r = 1; r < ($runs + 1); r++)) do echo -e "Run $r of $runs\n" db2 FLUSH PACKAGE CACHE DYNAMIC python reads.py -r1 -pquery1.sql -q$queries -shotelspec -k6 -a5 >> $outfile done The main command, the python read.py … etc. is another python file I’ve been given and have the arguments as you see. I know it is a lot to ask for, but it would really help me out if someone could convert this to a python script I can use or at least give me some hints and directions. Sincerely Mestika

    Read the article

  • Code Coverage and Unit Testing of Python Code

    - by bhadra
    I have already visited Preferred Python unit-testing framework. I am not just looking at Python Unit Testing Framework, but also code coverage with respect to unit tests. So far I have only come across coverage.py. Is there any better option? An interesting option for me is to integrate cpython, unit testing of Python code and code coverage of Python code with Visual Studio 2008 through plugins (something similar to IronPython Studio). What can be done to achieve this? I look forward to suggestions.

    Read the article

  • Why are Python exceptions named "Error"?

    - by Elena
    Why are Python exceptions named "Error" (e.g. ZeroDivisionError, NameError, TypeError etc) and not "Exception" (e.g. ZeroDivisionException, NameException, TypeException etc). I come from a Java background and started to learn Python recently, as such this is confusing because in java there is a distinction between error and exception. Is there a difference in Python also or not? Can someone explain or point me to some documentation explaining it? Thank you!

    Read the article

  • running python script with cron

    - by paulo
    hey guys, im trying to run a python script after every 5 minutes using cron, inside the script is a django import import django when running the crontab i get mailed the following error ImportError: No module named django this is what the crontab file looks like: [email protected] */5 * * * * /usr/bin/python /Users/paulo/Desktop/ashtanga/ping/sender.py do anyone of you know whats causing this ? btw i do have django insalled version 1.2, python 2.6, and MacOX 10.6

    Read the article

  • ways to execute python

    - by lakshmipathi
    So far to execute a python program , I'm using python file.py I want to run the python script simply using file name ,like file.py similar to shell scripts like sh file.sh chmod +x file.sh ./file.sh or move file.sh to bin and then run file.sh

    Read the article

  • Complementary language to learn after Python?

    - by BobDobbs
    As a reasonable proficient Python programmer, I'm wondering what a good second language to learn would be. More specifically, something that does well the things that Python doesn't in general do as well. My first guess would be C/C++ since it's got easy extensibility with Python and because it offers generally better performance, but I'm wondering if Java or C# might be a better or at least equivalently good option with different up/downsides compared to C/C++.

    Read the article

  • Python Sets vs Lists

    - by mvid
    In Python, which data structure is more efficient/speedy? Assuming that order is not important to me and I would be checking for duplicates anyway, is a Python set slower than a Python list?

    Read the article

  • How to parse ISO formatted date in python?

    - by Big 40wt Svetlyak
    I need to parse strings like that "2008-09-03T20:56:35.450686Z" into the python's datetime? I have found only strptime in the python 2.5 std lib, but it not so convinient. Which is the best way to do that? Update: It seems, that python-dateutil works very well. I have found that solution: d1 = '2008-09-03T20:56:35.450686Z' d2 = dateutil.parser.parse(d1) d3 = d2.astimezone(dateutil.tx.tzutc())

    Read the article

  • Discovery of web services using Python

    - by chrissygormley
    Hello, I have several devices on a network. I am trying to use a library to discover the presence and itentity of these devices using Python script, the devices all have a web service. My question is, are there any modules that would help me with this problem as the only module I have found is ws-discovery for Python? And if this is the only module does anyone have any example Python script using ws-discovery? Thanks for any help.

    Read the article

  • OpenCV, Python (ctypes), and OS X 10.5: dylib errors/confusion

    - by Jeff
    I have tried two brands of ctypes (ctypes-opencv and another) wrappers for OpenCV (2.0 from svn head), can use Python and OpenCV in the Python console, but whenever I try to import the packages (from ctypes_opencv import *) from another Python file, I get the following error message: OSError: dlopen(/usr/local/lib/libcv.dylib, 6): Symbol not found: __ZN2cv10fastMallocEm Referenced from: /usr/local/lib/libcv.dylib Expected in: flat namespace And some more Python errors: module body in __init__.py at line 18 from ctypes_opencv.cxcore import * module body in cxcore.py at line 80 _cxDLL, _cvDLL, _hgDLL = detect_opencv() function detect_opencv in cxcore.py at line 59 cvDLL = cdll.LoadLibrary(find_lib('cv')) function LoadLibrary in __init__.py at line 431 return self._dlltype(name) function __init__ in __init__.py at line 353 self._handle = _dlopen(self._name, mode) I most recently built OpenCV using flags the ctypes_opencv wiki recommended: ENABLE_SSE(2) OFF and BUILD_NEW_PYTHON_SUPPORT OFF. I've tried a number of flag combinations though. I also tried using the MacPorts install of OpenCV, got the same messages, uninstalled it, and now it errors out as well. :P And if that wasn't enough, I tried using the latest ctypes wrapper, but get boost-jam errors. Any help would be very much appreciated.

    Read the article

  • Eclipse and python: library will import in interprer, but not in IDE

    - by John
    I'm running Windows 7, Python 2.6.4 and the latest version of Eclipse. I downloaded the boto library (http://code.google.com/p/boto/) and ran python setup.py install, which created boto-1.9b-py2.6.egg in C:\Python26\Lib\site-packages. Importing a class - say, by doing 'from boto.sqs.connection import SQSConnection' - works fine from the python command line tool. But Eclipse will not find boto, despite the fact that it is using the same python interpreter as I am using when at the command line. I added the library as an external source folder, but that didn't work either. How can I properly import the boto library into Eclipse? Thanks.

    Read the article

  • How to scroll text in Python/Curses subwindow?

    - by lecodesportif
    In my Python script which uses Curses, I have a subwin to which some text is assigned. Because the text length may be longer than the window size, the text should be scrollable. It doesn't seem that there is any CSS-"overflow" like attribute for Curses windows. The Python/Curses docs are also rather cryptic on this aspect. Does anybody here have an idea how I can code a scrollable Curses subwindow using Python and actually scroll through it? \edit: more precise question

    Read the article

  • Why do you like Python?

    - by Arnav
    I have to make a presentation at work to convince everyone why they should try coding in Python. So, I thought of taking a poll here... What is it about Python (features, etc) over other languages that you love? The reason I usually give is that in Python you forget about the complexities and frills of programming languages and can just focus on producing code that works... What do you think?

    Read the article

  • boost graph adjacency_list, retrieving a node's parents

    - by Juan
    I want to find in an adjacency graph from the bgl how give a Vertexdescriptor and get the set of nodes that are parents of this given node. i would like to do this in directed graph, it seems you could use a bidirectional graph but i want to be able to restrict it so that there are no cycles.

    Read the article

  • Profiling python C extensions

    - by pygabriel
    I have developed a python C-extension that receives data from python and compute some cpu intensive calculations. It's possible to profile the C-extension? The problem here is that writing a sample test in C to be profiled would be challenging because the code rely on particular inputs and data structures (generated by python control code). Do you have any suggestions?

    Read the article

  • Advantages/disadvantages of Python and Ruby

    - by Seburdis
    I know this is going to seem a little like all the other python vs ruby question out there, but I'm not looking specifically to pick one over the other all the time. My question is, essentially, why would you use one language over the other when you are starting a new project? What features does ruby have that python doesn't that would make you decide on it for a given project? What about python over ruby? I was just recently thinking about the differentiation between the two languages because of Jamis Buck's "There is no magic, only awesome" series of articles (4 parts, available here) when I realized I really don't know enough about the two languages to know when to choose one over the other. I'm hoping to get objective answers from people who have experience with both languages, rather than just "python is better, ruby sucks" kind of responses. If you know of a feature in one language that doesn't exist in the other and is great in a certain situation, feel free to chime in and say why you think it's awesome. If you have another language comparable to these that you'd like to suggest pros/cons for, like groovy for example, that would be appreciated too. Some thing I know each language has going for it: Ruby: Awesome metaprogramming Great community Wide selection of Gems Rails Great code readability, usually MacRuby is great for native development on Mac without objc Amazing testing tools (cucumber, rspec, shoulda, autotest, etc.) Python: Whitespace indentation List comprehensions Better functional programming support? Lots of support on linux Easy_install isn't far from gems Great variety of libraries available

    Read the article

  • python read utf8 text file problem

    - by cpps
    I have a problem with python about reading and print utf8 text file. I have a test.txt in utf8 encoding without BOM. This file has two characters in it: ?? The first character "?" is Chinese and the second "?" is Japanese. Now, When I use Ulipad (a python editor) to run the following code to read the txt file, and print these two characters. import codecs infile = "C:\\test.txt" f = codecs.open(infile, "r", "utf-8") s = f.read() print(s) I got this error, "UnicodeEncodeError: 'cp950' codec can't encode character '\u58f0' in position 1: illegal multibyte sequence" I found it caused from the second character "?" . But when I use the same code to test in python default GUI IDLE, it works to print the two characters with no error. So, how can I fix the problem. My running environment is python 3.1 , windows xp traditional Chinese.

    Read the article

  • How do I install a python package

    - by Thiago
    Hi, I want to install this python package: http://pypi.python.org/pypi/netifaces/0.5 But I don't know how and I know nothing about python. Still, I guess there is a standardized way to install it. Am I right? Thanks in advance

    Read the article

  • agent-based simulation: performance issue: Python vs NetLogo & Repast

    - by max
    I'm replicating a small piece of Sugarscape agent simulation model in Python 3. I found the performance of my code is ~3 times slower than that of NetLogo. Is it likely the problem with my code, or can it be the inherent limitation of Python? Obviously, this is just a fragment of the code, but that's where Python spends two-thirds of the run-time. I hope if I wrote something really inefficient it might show up in this fragment: UP = (0, -1) RIGHT = (1, 0) DOWN = (0, 1) LEFT = (-1, 0) all_directions = [UP, DOWN, RIGHT, LEFT] # point is just a tuple (x, y) def look_around(self): max_sugar_point = self.point max_sugar = self.world.sugar_map[self.point].level min_range = 0 random.shuffle(self.all_directions) for r in range(1, self.vision+1): for d in self.all_directions: p = ((self.point[0] + r * d[0]) % self.world.surface.length, (self.point[1] + r * d[1]) % self.world.surface.height) if self.world.occupied(p): # checks if p is in a lookup table (dict) continue if self.world.sugar_map[p].level > max_sugar: max_sugar = self.world.sugar_map[p].level max_sugar_point = p if max_sugar_point is not self.point: self.move(max_sugar_point) Roughly equivalent code in NetLogo (this fragment does a bit more than the Python function above): ; -- The SugarScape growth and motion procedures. -- to M ; Motion rule (page 25) locals [ps p v d] set ps (patches at-points neighborhood) with [count turtles-here = 0] if (count ps > 0) [ set v psugar-of max-one-of ps [psugar] ; v is max sugar w/in vision set ps ps with [psugar = v] ; ps is legal sites w/ v sugar set d distance min-one-of ps [distance myself] ; d is min dist from me to ps agents set p random-one-of ps with [distance myself = d] ; p is one of the min dist patches if (psugar >= v and includeMyPatch?) [set p patch-here] setxy pxcor-of p pycor-of p ; jump to p set sugar sugar + psugar-of p ; consume its sugar ask p [setpsugar 0] ; .. setting its sugar to 0 ] set sugar sugar - metabolism ; eat sugar (metabolism) set age age + 1 end On my computer, the Python code takes 15.5 sec to run 1000 steps; on the same laptop, the NetLogo simulation running in Java inside the browser finishes 1000 steps in less than 6 sec. EDIT: Just checked Repast, using Java implementation. And it's also about the same as NetLogo at 5.4 sec. Recent comparisons between Java and Python suggest no advantage to Java, so I guess it's just my code that's to blame? EDIT: I understand MASON is supposed to be even faster than Repast, and yet it still runs Java in the end.

    Read the article

  • Python Django vs ASP.NET MVC

    - by eddyc05
    Hey guys ! i'm fairly new at web development scene and i was wondering if you guys can help me break up the pros and cons of using python django vs asp.net mvc besides the maturity level of its framework. I have intermediate experience with JAVA. As of right now, i'm leaning towards python but i just wanted to make sure i am making the right choice. I find myself limited with books available on asp.net web developments. I am aware that there is the storefront example on the official asp.net site. However, that tutorial was a little hard for me to follow. I've done a research around and was hoping python could be my next available choice. There are more tutorials available online for python anyways. What do you guys think??

    Read the article

  • Python Core Library and PEP8

    - by Szymon Guz
    I was trying to understand why Python is said to be a beautiful language. I was directed to the beauty of PEP 8... and it was strange. In fact it says that you can use any convention you want, just be consistent... and suddenly I found some strange things in the core library: request() getresponse() set_debuglevel() endheaders() http://docs.python.org/py3k/library/http.client.html The below functions are new in the Python 3.1. What part of PEP 8 convention is used here? popitem() move_to_end() http://docs.python.org/py3k/library/collections.html So my question is: is PEP 8 used in the core library, or not? Why is it like that? Is there the same situation as in PHP where I cannot just remember the name of the function because there are possible all ways of writing the name? Why PEP 8 is not used in the core library even for the new functions?

    Read the article

< Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >