Search Results

Search found 15629 results on 626 pages for 'mod python'.

Page 2/626 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Using Crypt function Python 3.3.2

    - by adampski
    In Windows and Python version 3.3.2, I try and call the python module like so: hash2 = crypt(word, salt) I import it at the top of my program like so: from crypt import * The result I get is the following: Traceback (most recent call last): File "C:\none\of\your\business\adams.py", line 10, in <module> from crypt import * File "C:\Python33\lib\crypt.py", line 3, in <module> import _crypt ImportError: No module named '_crypt' However, when I execute the same file adams.py in Ubuntu, with Python 2.7.3, it executes perfectly - no errors. I tried the following to resolve the issue for my Windows & Python 3.3.2 (though I'm sure the OS isn't the issue, the Python version or my use of syntax is the issue): Rename the directory in the Python33 directory from Lib to lib Rename the crypt.py in lib to _crypt.py. However, it turns out the entire crypt.py module depends on an external module called _crypt.py too. Browsed internet to download anything remotely appropriate to resemble _crypt.py It's not Python, right? It's me...(?) I'm using syntaxes to import and use external modules that are acceptable in 2.7.3, but not in 3.3.2. Or have I found a bug in 3.3.2?

    Read the article

  • Python 2 dict_items.sort() in Python 3

    - by DaveWeber
    I'm porting some code from Python 2 to 3. This is valid code in Python 2 syntax: def print_sorted_dictionary(dictionary): items=dictionary.items() items.sort() In Python 3, the dict_items have no method 'sort' - how can I make a workaround for this in Python 3?

    Read the article

  • Making python 3.3 default python 3 interpreter instead of 3.2

    - by user1873947
    So, to keep it simple. Ubuntu 12.10 has python 3.2 pre installed and it is linked to "python3". I downloaded python 3.3 and it's command is "python3.3". However, I downloaded pySide for python3 from synaptic. Using "from PySide.QtCore import *" fails on python3.3. BUT, when I ran just "python3" (aka 3.2) everything works fine. Synaptic just installed lib for python3.2 which is default for python3 in ubuntu. How can I force synaptic to install modules for python3.3? Thanks

    Read the article

  • Best practise for Progress Bar in Python's PyGTK

    - by Matthew Walker
    I would like to get feedback on others' opinions of best practice for how to implement a progress bar in Python's PyGTK. The work that the progress bar was to represent was very significant computationally. Therefore, I wanted the work to be done in a separate process (thus giving the operating system the possibility to run it on a different core). I wanted to be able to start the work, and then continue to use the GUI for other tasks while waiting for the results. I have seen many people asking this question indirectly, but I have not seen any concrete expert advice. I hope that by asking this question we will see a community's combined expertise. I have read the FAQ and I hope that "Programmers" is the right place to ask.

    Read the article

  • sudo apt-get install python.pip python-dev Gives Error

    - by user2539745
    I am learning Django from http://gettingstartedwithdjango.com/ and I have windows 7 32-bit. The tutorial asked to install virtualbox and vagrant(tutorial had precise64 and it had issues in my pc so I installed precise32) so I did it. Now the tutorial asked to do sudo apt-get install python-dev python.pip so I did it but it gave me this error > vagrant@precise32:~$ sudo apt-get install python.pip python-dev Reading package lists... Done Building dependency tree Reading state information... Done Note, selecting 'python-pip' for regex 'python.pip' Note, selecting 'python-pipeline' for regex 'python.pip' The following extra packages will be installed: libexpat1 libexpat1-dev libpython2.7 python-pkg-resources python-setuptools python-support python2.7 python2.7-dev python2.7-minimal Suggested packages: python-distribute python-distribute-doc python2.7-doc binfmt-support The following NEW packages will be installed: libexpat1-dev libpython2.7 python-dev python-pip python-pipeline python-pkg-resources python-setuptools python-support python2.7-dev The following packages will be upgraded: libexpat1 python2.7 python2.7-minimal 3 upgraded, 9 newly installed, 0 to remove and 63 not upgraded. Need to get 34.7 MB/35.7 MB of archives. After this operation, 42.0 MB of additional disk space will be used. Do you want to continue [Y/n]? y Err (http removed)us.archive.ubuntu.com/ubuntu/ precise-updates/main python2.7 i386 2.7 .3-0ubuntu3.1 404 Not Found [IP: 91.189.91.15 80] Err (http removed)us.archive.ubuntu.com/ubuntu/ precise-updates/main python2.7-minimal i386 2.7.3-0ubuntu3.1 404 Not Found [IP: 91.189.91.15 80] Err (http removed)us.archive.ubuntu.com/ubuntu/ precise-updates/main libpython2.7 i386 2.7.3-0ubuntu3.1 404 Not Found [IP: 91.189.91.15 80] Err (http removed)us.archive.ubuntu.com/ubuntu/ precise-updates/main python2.7-dev i386 2.7.3-0ubuntu3.1 404 Not Found [IP: 91.189.91.15 80] Failed to fetch (http removed)us.archive.ubuntu.com/ubuntu/pool/main/p/python2.7/python 2.7_2.7.3-0ubuntu3.1_i386.deb 404 Not Found [IP: 91.189.91.15 80] Failed to fetch (http removed)us.archive.ubuntu.com/ubuntu/pool/main/p/python2.7/python 2.7-minimal_2.7.3-0ubuntu3.1_i386.deb 404 Not Found [IP: 91.189.91.15 80] Failed to fetch (http removed)us.archive.ubuntu.com/ubuntu/pool/main/p/python2.7/libpyt hon2.7_2.7.3-0ubuntu3.1_i386.deb 404 Not Found [IP: 91.189.91.15 80] Failed to fetch (http removed)us.archive.ubuntu.com/ubuntu/pool/main/p/python2.7/python 2.7-dev_2.7.3-0ubuntu3.1_i386.deb 404 Not Found [IP: 91.189.91.15 80] E: Unable to fetch some archives, maybe run apt-get update or try with --fix-mis sing? Please help what should I do ??

    Read the article

  • Python IDLE: How to type correct indentation?

    - by user2988464
    Mac: Maverick Python: 3.4 I tried to testtimeit module in Python's IDLE import timeit >>> timeit.timeit( "obj.method", """ class SomeClass: def method(self): pass obj = SomeClass() """) When I tried to type def method(self): on the next line of class SomeClass, I hit Tab, it prompted a window showing the files inside my Document directory. So I hit Ctrl+Tab instead. But I still got the error: Traceback (most recent call last): File "<pyshell#26>", line 6, in <module> """) File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/timeit.py", line 213, in timeit return Timer(stmt, setup, timer).timeit(number) File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/timeit.py", line 122, in __init__ code = compile(src, dummy_src_name, "exec") File "<timeit-src>", line 9 _t0 = _timer() ^ IndentationError: unindent does not match any outer indentation level Can someone explain: how to fix it, and how to avoid the prompt of My Document appear? Thx!!!

    Read the article

  • How to install python modules for specific python version

    - by Zayatzz
    I needed to install UCS2 python next to UCS4 python. So I went to comp.lang.python and asked them about it. Probably not the best place to ask it, but they answered https://groups.google.com/forum/?fromgroups#!topic/comp.lang.python/bGuAfqa76W8 and now i have brand new python 2.7.3 ucs2 installed in /opt/bin/python What I need now is - how can I install all other python modules that I have installed for that python version also. Basically stuff like PIL and postgresql and mod_wsgi - basically everything needed to run Django for that python version. Is this the right the place to ask for it?

    Read the article

  • modsecurity apache mod-security.conf missing

    - by TechMedicNYC
    Greetings Serverfaultians. I'm not a server guy as you can see from my noob score of 1 point. But maybe those more versed can help me. I'm using Ubuntu v13.10 32-bit Server and Apache2 v2.4.6 and I'm trying to set up and configure modsecurity and modevasive on an internet-exposed production/test server. I am trying to follow this tutorial: http://www.thefanclub.co.za/how-to/how-install-apache2-modsecurity-and-modevasive-ubuntu-1204-lts-server. But at step 3: Now add these rules to Apache2. Open a terminal window and enter: sudo vi /etc/apache2/mods-available/mod-security.conf This file does not exist. Any suggestions?

    Read the article

  • call python with system() in R to run a python script emulating the python console

    - by Yihui
    I want to pass a chunk of Python code to Python in R with something like system('python ...'), and I'm wondering if there is an easy way to emulate the python console in this case. For example, suppose the code is "print 'hello world'", how can I get the output like this in R? >>> print 'hello world' hello world This only shows the output: > system("python -c 'print \"hello world\"'") hello world Thanks! BTW, I asked in r-help but have not got a response yet (if I do, I'll post the answer here).

    Read the article

  • Mod Rewrite - directing HTTP/HTTPS traffic to the appropriate virtual hosts

    - by kce
    I have an Apache2 web server (v. 2.2.16) running on Debian hosting three virtual hosts. The first two hosts are HTTP only (server1 and server2). The last host is HTTPS only (server3). My virtual host configuration files can be found at pastebin. I would like to use mod rewrite to get the following behavior: Any request for http://server3 is re-directed to https://server3 Any request for either https://server1 or https://server2 is re-directed to http://server1 or http://server2 as appropriate. Currently, requesting http://server3 gives you a 403 because indexing is disabled for that host and a request for https://server1 or https://server2 will resolve as https://server3 (as its the only virtual host running SSL). This behavior is not desirable. So far I have added a rewrite rule to the central configuration file (myServerWideConfs.conf), with unfortunately no effect. I was under the impression that this rule (or something similar) should rewrite all https:// requests for server1 and server2 to the proper http:// request. RewriteEngine On RewriteCond %{HTTP_HOST} !^server3 [NC] RewriteRule (.*) http://%{HTTP_HOST} My question is two-fold: What mod rewrite rules should I use to accomplish this? And where should they go? Debian's packaging of Apache has a pretty granular (i.e., fractured) configuration file layout; should my rewrite rules go in /etc/apache2/apache2.conf, /etc/apache2/conf.d/myServerWideConfs.conf, or the individual virtual host files? Is mod rewrite the right tool to accomplish this or am I missing something in my greater apache configuration?

    Read the article

  • Installing PIL (Python Imaging Library) in Win7 64 bits, Python 2.6.4

    - by Rafael Almeida
    I'm trying to install said library for use with Python. I tried downloading the executable installer for Windows, which runs, but says it doesn't find a Python installation. Then tried registering (http://effbot.org/zone/python-register.htm) Python, but the script says it can't register (although the keys appear in my register). Then I tried downloading the source package: I run the setup.py build and it works, but when I run setup.py install it says the following: running install running build running build_py running build_ext building '_imaging' extension error: Unable to find vcvarsall.bat What can I do?

    Read the article

  • How to become a solid python web developer [closed]

    - by Estarius
    Possible Duplicate: How do I learn Python from zero to web development? I have started Python recently with the goal to become a solid developer to make a web application eventually. However, as time goes by I am wondering if I am being optimal about how I will achieve my goal. I would compare it to a game for example, to be better you must spend time playing and trying new things... However, if you just log in and sit in the lobby chatting you are most likely not progressing. So far, this is my plan (feel free to comment or judge it): Review basic programmation concepts Start coding slowly in Python Once comfortable in Python, learn about web development in Python Learn about those things we heard about: SQLAlchemy, MVC, TDD, Git, Agile (Group project) To achieve these things, I started the Learn python the hard way exercises, which I am doing at the rate of 5 per days. I also started to read Think Python at the same time and planning to move on with Dive into python. As far as my research goes, these documentations along with Python documentation is usually what is the most recommended to learn Python. I consider this to get my point 1 and 2 done. While learning Python is really great, my goal remains to do quality web development. I know there are books about Django etc. however I would like to become comfortable with any Python web development. This means without Framework and with Framework... Any framework, then be able to choose the one which best fits our needs. For this I would like to know if some people have suggestions. Should I just get a book on Django and it should apply to everything ? What would be the best method to go from Python to Web Python and not end up creating crappy code which would turn into nightmares for other programmers ? Then finally, those "things we hear about". While I understand what they all do basically, I am fairly sure that like everything, there are good and wrong ways of making use of them. Should I go through at least a whole book on each before starting to use them or keep it at their respective online documentation ? Are there some kind of documentation which links their use to Python ? Also, from looking at Django and Pyramid they seems to use something else than MVC, while the Django model looks similar, the Pyramid one seems to cut a whole part of it... Is learning MVC still worth it ? Sorry for the wall of text, Thanks in advance !

    Read the article

  • Why do people hesitate using Python 3?

    - by Ham
    Python 3 has been released in December 2008. A lot of time has passed since then but still today many developers hesitate using Python 3. Even popular frameworks like Django are not compatible with Python 3 yet but still rely on Python 2. Sure, Python 3 has some incompatibilities to Python 2 and some people need to rely on backwards-compatibility. But hasn't Python 3 been around long enough now for most projects to switch or start with Python 3? Having two competiting versions has so many drawbacks; two branches need to be maintained, confusion for learners and so on, so why is there such a big hesitation throughout the Python community in switching to Python 3?

    Read the article

  • Cannot compile GDB7.8 with Python support

    - by j0h
    I am trying to install GDB7.8 with Python support. From the source folder, I am running ./configure --with-python When I did tab-complete from --with- I did not see Python in the list. But when I ran configure with that flag, it did not baulk. When I run make, it complains that Python is not found. checking for python2.7... no but Python is installed: $ which python python python2.7 python2.7-dbg-config python2 python2.7-dbg $ which python2.7 /usr/bin/python2.7 I compiled GDB without --with-python and things installed without error. I was under the impression that GDB7.8 had Python support without the need for special flags. But when I run: $gdb python (gdb) run test.py I get some sort of cannot import gdb Import error So then I tried calling "pi": (gdb) pi printf.py Python scripting is not supported in this copy of GDB. So... how do I get Python support in GDB7.8? is it actually not supported? Or should I not call "pi"?

    Read the article

  • Fastest image iteration in Python

    - by Greg
    I am creating a simple green screen app with Python 2.7.4 but am getting quite slow results. I am currently using PIL 1.1.7 to load and iterate the images and saw huge speed-ups changing from the old getpixel() to the newer load() and pixel access object indexing. However the following loop still takes around 2.5 seconds to run for an image of around 720p resolution: def colorclose(Cb_p, Cr_p, Cb_key, Cr_key, tola, tolb): temp = math.sqrt((Cb_key-Cb_p)**2+(Cr_key-Cr_p)**2) if temp < tola: return 0.0 else: if temp < tolb: return (temp-tola)/(tolb-tola) else: return 1.0 .... for x in range(width): for y in range(height): Y, cb, cr = fg_cbcr_list[x, y] mask = colorclose(cb, cr, cb_key, cr_key, tola, tolb) mask = 1 - mask bgr, bgg, bgb = bg_list[x,y] fgr, fgg, fgb = fg_list[x,y] pixels[x,y] = ( (int)(fgr - mask*key_color[0] + mask*bgr), (int)(fgg - mask*key_color[1] + mask*bgg), (int)(fgb - mask*key_color[2] + mask*bgb)) Am I doing anything hugely inefficient here which makes it run so slow? I have seen similar, simpler examples where the loop is replaced by a boolean matrix for instance, but for this case I can't see a way to replace the loop. The pixels[x,y] assignment seems to take the most amount of time but not knowing Python very well I am unsure of a more efficient way to do this. Any help would be appreciated.

    Read the article

  • Python requests - saving cookie for later url usage

    - by PythonRocks
    I been trying to get a cookie and post it to a url in later use in the program, but I cant seem to get the cookie parameters to work. Right now I have response = requests.get("url") But how exactly do I retrive cookies from this url and post them to a new url (the same cookies). The tutorial in requests is somewhat vague on the topic and gives examples I cannot test. Hope someone can help with further examples. This is python 2.7 btw.

    Read the article

  • Python Parse regex

    - by Nemo
    Let's say I have string in the form given below: myString={"name", "age", "address", "contacts", "Email"} I need to get all the items of myString into a List using python. Here's what I did r= re.search("myString=\{\"(.+)\", $\}", line) if r: items.append(r.group(1)) print(items) Here line is the variable that holds the content of my text file. What change do I have to make to my regex to get all the items in myString? Please kindly help me out. Thanks.

    Read the article

  • what is the differences between (libapache2-mod-php5 ) and ( libapache2-mod-php5filter)

    - by tawfekov
    i had noticed that some code doesn't play nice when i use libapache2-mod-filter while it working as expected in libapache2-mod-php5 the error was generated by doctrine + it's very simple like : $db = new self(); $db["name"] = $name; $db["desc"] = $desc; $db->save(); /// it throw the error here error message like : Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc) VALUES ('aaaaaaaaaaa', 'aaaaaaaaaaaa')' at line 1 so what is the real difference between the both modules for php5 ???

    Read the article

  • python metaprogramming

    - by valya
    I'm trying to archive a task which turns out to be a bit complicated since I'm not very good at Python metaprogramming. I want to have a module locations with function get_location(name), which returns a class defined in a folder locations/ in the file with the name passed to function. Name of a class is something like NameLocation. So, my folder structure: program.py locations/ __init__.py first.py second.py program.py will be smth with with: from locations import get_location location = get_location('first') and the location is a class defined in first.py smth like this: from locations import Location # base class for all locations, defined in __init__ (?) class FirstLocation(Location): pass etc. Okay, I've tried a lot of import and getattribute statements but now I'm bored and surrender. How to archive such behaviour?

    Read the article

  • bad request error 400 while using python requests.post function

    - by Toussah
    I'm trying to make a simple post request via the requests library of Python and I get a bad request error (400) while my url is supposedly correct since I can use it to perform a get. I'm very new in REST requests, I read many tutorials and documentation but I guess there are still things I don't get so my error could be basic. Maybe a lack of understanding on the type of url I'm supposed to send via POST. Here my code : import requests v_username = "username" v_password = "password" v_headers = {'content-type':'application/rdf+xml'} url = 'https://my.url' params = {'param': 'val_param'} payload = {'data': 'my_data'} r = requests.post(url, params = params, auth=(v_username, v_password), data=payload, headers=v_headers, verify=False) print r I used the example of the requests documentation.

    Read the article

  • Mod Rewrite - url rewriting

    - by modrewriteNewbie
    I am very new to mod rewrite. I need to redirect any user with "citzenhawk" parameter in their url to my url for example http://www.mywebsite.com/?sc=CX12N003&cm_mmc=affiliate--citizenhawk--nooffer-_-na&prfc=5&clickid=0004c845fa9a87050a4277221a003262 should result into http://www.mywebsite.com/ Here are my rewrite conditions: RewriteCond %{QUERY_STRING} (&|^)cm_mmc=(.)citizenhawk(.)(&|$)$ RewriteRule ^/rrs/ [NC,R=302,L] Where am I going wrong? Is my RewriteCond wrong?

    Read the article

  • Bit by bit comparison of using Java or Python for unit testing frameworks and Selenium

    - by Anirudh
    Currently we are in the process of finalizing which language out of Java, Python should be used for Automation using selenium webdriver and a suitable unit testing frameworks. I have made use of Junit, TestNG and webdriver while using with Java and have designed frameworks without much fuss before. I am new to python though I came across pyhton's unit testing frameworks like unittest, pyunit, nose e.t.c but I have doubts if they would be as successful as testNG or Java. I would like to analyze point by point when used with selenium webdriver as below: 1)I have read that as Python is an interpreted language hence it's execution is slower, so say if I have to run 1000 test cases which take about 6 hours to run in Java, would python take considerably longer time for the same test cases like 8 hours? 2)Can the Python unit testing framework be as flexible as a Java unit testing framework like testNG in terms or Grouping the tests, parallel execution, skipping test. e.t.c 3)Also one point that I think of is that Python with selenium webdriver doeasn't have as big or learned community as we have for Java with webdriver, say if I run into trouble with something I am more likely to find an answer for Java as compared to python? 4)Somewhat related to point 3, is it safe to rely on tools, plugins or even webderiver's python's binding as a continuously well maintained? 5)One major drawback as I see while using python's unit testing framework is lack of boilerplate code or libraries for nicely illustrative HTML reports preferably historical reports with Pie charts, bar graphs and timelines as we have in case of Java like Allure, TestNG's default reports, reportNG or Junit reports with the help of ANT as shown below Allure Reports Junit Historical reports Also I would like to emphasize on the fact if there is a way for one to write the framework in java and make libraries or utilities according to out application in webdriver which can easily be called or integrated in with python code or modules? That would actually solve the problem for us as the client would be able to use the code we write in Java and make use of the same or call it from their python modules?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >