I have trouble of obtaining the file size of a file because the
fullpath exceeds 255 characters. I get this message with
os.path.getsize (fullpath).
fullpath = r"\\LOSSSFS002\ NWE_TECHNICAL\0 5. UK\Schiehallion (204_25a)
\Amos&Burke_P55 9\07. Technical (Subsurface)\06 . Well Planning\Amos
\Daily Reports\Wirelin e\final_204_25a _8z\204_25a_8z\ Run_1A
\HRLA_SP_DSI_PE X_HNGS_ECRD\ANC ILLARY\Amos_204 _25a-8Z_GR_to_surfac e_3-
Mar-2008_DSI_HRLA_T LD_MCFL_047PUC. las"
fsize = os.path.getsize (fullpath)
WindowsError: [Error 206] The filename or extension is too long:
The same thing with os.stat(fullpat h).
I tried using the relative path, but it does not work with the message
fname not found.
dir = os.path.dirname (fullpath)
fname = os.path.basenam e(fullpath)
os.chdir(dir)
filesize = os.path.getsize (fname)
Is there a walk around of this? 8 9096 yg*****@gmail.c om writes:
I have trouble of obtaining the file size of a file because the
fullpath exceeds 255 characters. I get this message with
os.path.getsize (fullpath).
fullpath = r"\\LOSSSFS002\ NWE_TECHNICAL\0 5. UK\Schiehallion (204_25a)
\Amos&Burke_P55 9\07. Technical (Subsurface)\06 . Well Planning\Amos
\Daily Reports\Wirelin e\final_204_25a _8z\204_25a_8z\ Run_1A
\HRLA_SP_DSI_PE X_HNGS_ECRD\ANC ILLARY\Amos_204 _25a-8Z_GR_to_surfac e_3-
Mar-2008_DSI_HRLA_T LD_MCFL_047PUC. las"
fsize = os.path.getsize (fullpath)
WindowsError: [Error 206] The filename or extension is too long:
The same thing with os.stat(fullpat h).
I tried using the relative path, but it does not work with the message
fname not found.
dir = os.path.dirname (fullpath)
fname = os.path.basenam e(fullpath)
os.chdir(dir)
filesize = os.path.getsize (fname)
Is there a walk around of this?
Disclaimer: I am not a Windows user
Might this help? http://forum.altap.cz/viewtopic.php?p=2353
Alternately, use a better OS :-)
--
Arnaud
On May 13, 3:49*pm, Arnaud Delobelle <arno...@google mail.comwrote:
ygua...@gmail.c om writes:
I have trouble of obtaining the file size of a file because the
fullpath exceeds 255 characters. I get this message with
os.path.getsize (fullpath).
fullpath = r"\\LOSSSFS002\ NWE_TECHNICAL\0 5. UK\Schiehallion (204_25a)
\Amos&Burke_P55 9\07. Technical (Subsurface)\06 . Well Planning\Amos
\Daily Reports\Wirelin e\final_204_25a _8z\204_25a_8z\ Run_1A
\HRLA_SP_DSI_PE X_HNGS_ECRD\ANC ILLARY\Amos_204 _25a-8Z_GR_to_surfac e_3-
Mar-2008_DSI_HRLA_T LD_MCFL_047PUC. las"
fsize = os.path.getsize (fullpath)
WindowsError: [Error 206] The filename or extension is too long:
The same thing with os.stat(fullpat h).
I tried using the relative path, but it does not work with the message
fname not found.
dir = os.path.dirname (fullpath)
fname = os.path.basenam e(fullpath)
os.chdir(dir)
filesize = os.path.getsize (fname)
Is there a walk around of this?
Disclaimer: I am not a Windows user
Might this help? *http://forum.altap.cz/viewtopic.php?p=2353
Alternately, use a better OS :-)
--
Arnaud- Hide quoted text -
- Show quoted text -
I tried, but still the same error:
WindowsError: [Error 206] The filename or extension is too long: '\\\\?
\\UNC\\LOSSSFS0 02\\NWE_TECHNIC AL\\05. UK\\Schiehallio n (204_25a)\
\Amos&Burke_P55 9\\07. Technical (Subsurface)\\0 6. Well Planning\\Amos\
\Daily Reports\\Wireli ne\\final_204_2 5a_8z\\204_25a_ 8z\\Run_1A\
\HRLA_SP_DSI_PE X_HNGS_ECRD\\AN CILLARY\\Amos_2 04_25a-8Z_GR_to_surfac e_3-
Mar-2008_DSI_HRLA_T LD_MCFL_047PUC. las' yg*****@gmail.c om wrote:
I have trouble of obtaining the file size of a file because the
fullpath exceeds 255 characters. I get this message with
os.path.getsize (fullpath).
fullpath = r"\\LOSSSFS002\ NWE_TECHNICAL\0 5. UK\Schiehallion (204_25a)
\Amos&Burke_P55 9\07. Technical (Subsurface)\06 . Well Planning\Amos
\Daily Reports\Wirelin e\final_204_25a _8z\204_25a_8z\ Run_1A
\HRLA_SP_DSI_PE X_HNGS_ECRD\ANC ILLARY\Amos_204 _25a-8Z_GR_to_surfac e_3-
Mar-2008_DSI_HRLA_T LD_MCFL_047PUC. las"
fsize = os.path.getsize (fullpath)
WindowsError: [Error 206] The filename or extension is too long:
The same thing with os.stat(fullpat h).
I tried using the relative path, but it does not work with the message
fname not found.
dir = os.path.dirname (fullpath)
fname = os.path.basenam e(fullpath)
os.chdir(dir)
I suspect that the cause of the problem here is that while *x OSes have
just one current working directory, Windows has one cwd per drive.
filesize = os.path.getsize (fname)
Is there a walk around of this?
At the DOS command level, you can do
subst x: very\long\path
and then refer to
x:filestem.ext
where x is any unused drive letter.
This seems to work:
>>import os os.system('su bst x: c:\\junk')
0
>>f = open('x:foo.py' ) f.read()
"print 'hello'\n"
>>>
HTH,
John
On May 13, 4:38*pm, John Machin <sjmac...@lexic on.netwrote:
ygua...@gmail.c om wrote:
I have trouble of obtaining the file size of a file because the
fullpath exceeds 255 characters. I get this message with
os.path.getsize (fullpath).
fullpath = r"\\LOSSSFS002\ NWE_TECHNICAL\0 5. UK\Schiehallion (204_25a)
\Amos&Burke_P55 9\07. Technical (Subsurface)\06 . Well Planning\Amos
\Daily Reports\Wirelin e\final_204_25a _8z\204_25a_8z\ Run_1A
\HRLA_SP_DSI_PE X_HNGS_ECRD\ANC ILLARY\Amos_204 _25a-8Z_GR_to_surfac e_3-
Mar-2008_DSI_HRLA_T LD_MCFL_047PUC. las"
fsize = os.path.getsize (fullpath)
WindowsError: [Error 206] The filename or extension is too long:
The same thing with os.stat(fullpat h).
I tried using the relative path, but it does not work with the message
fname not found.
dir = os.path.dirname (fullpath)
fname = os.path.basenam e(fullpath)
os.chdir(dir)
I suspect that the cause of the problem here is that while *x OSes have
just one current working directory, Windows has one cwd per drive.
filesize = os.path.getsize (fname)
Is there a walk around of this?
At the DOS command level, you can do
* * *subst x: very\long\path
and then refer to
* * *x:filestem.ext
where x is any unused drive letter.
This seems to work:
*>>import os
*>>os.system('s ubst x: c:\\junk')
0
*>>f = open('x:foo.py' )
*>>f.read()
"print 'hello'\n"
*>>>
HTH,
John- Hide quoted text -
- Show quoted text -
Good idea. But subst does not see to work with path that has spaces.
It gives "Incorrect number of parameters" yg*****@gmail.c om wrote:
On May 13, 4:38 pm, John Machin <sjmac...@lexic on.netwrote:
>ygua...@gmail. com wrote:
>>I have trouble of obtaining the file size of a file because the fullpath exceeds 255 characters. I get this message with
At the DOS command level, you can do subst x: very\long\path and then refer to x:filestem.ext where x is any unused drive letter.
Good idea. But subst does not see to work with path that has spaces.
It gives "Incorrect number of parameters"
If any DOS command-line argument includes spaces, you need to quote it.
os.system(r'sub st x: "c:\my big fat path\rab oof\etc etc etc"')
On May 13, 5:31*pm, John Machin <sjmac...@lexic on.netwrote:
ygua...@gmail.c om wrote:
On May 13, 4:38 pm, John Machin <sjmac...@lexic on.netwrote:
ygua...@gmail.c om wrote: I have trouble of obtaining the file size of a file because the fullpath exceeds 255 characters. I get this message with
At the DOS command level, you can do
* * *subst x: very\long\path
and then refer to
* * *x:filestem.ext
where x is any unused drive letter.
Good idea. But subst does not see to work with path that has spaces.
It gives "Incorrect number of parameters"
If any DOS command-line argument includes spaces, you need to quote it.
os.system(r'sub st x: "c:\my big fat path\rab oof\etc etc etc"')
Yes, it works now. I am getting more on windows after coming a long
way from Unix. Thanks a lot.
<yg*****@gmail. comwrote in message
news:41******** *************** ***********@z72 g2000hsb.google groups.com...
>I have trouble of obtaining the file size of a file because the
fullpath exceeds 255 characters. I get this message with
os.path.getsize (fullpath).
fullpath = r"\\LOSSSFS002\ NWE_TECHNICAL\0 5. UK\Schiehallion (204_25a)
\Amos&Burke_P55 9\07. Technical (Subsurface)\06 . Well Planning\Amos
\Daily Reports\Wirelin e\final_204_25a _8z\204_25a_8z\ Run_1A
\HRLA_SP_DSI_PE X_HNGS_ECRD\ANC ILLARY\Amos_204 _25a-8Z_GR_to_surfac e_3-
Mar-2008_DSI_HRLA_T LD_MCFL_047PUC. las"
fsize = os.path.getsize (fullpath)
WindowsError: [Error 206] The filename or extension is too long:
The same thing with os.stat(fullpat h).
I tried using the relative path, but it does not work with the message
fname not found.
dir = os.path.dirname (fullpath)
fname = os.path.basenam e(fullpath)
os.chdir(dir)
filesize = os.path.getsize (fname)
Is there a walk around of this?
You need to use the '\\?\UNC\' prefix and specify the path
in unicode (Python 2.5 and up).
Roger
En Tue, 13 May 2008 18:06:13 -0300, <yg*****@gmail. comescribió:
On May 13, 3:49*pm, Arnaud Delobelle <arno...@google mail.comwrote:
>ygua...@gmail. com writes:
I have trouble of obtaining the file size of a file because the
fullpath exceeds 255 characters. I get this message with
WindowsError: [Error 206] The filename or extension is too long: '\\\\?
\\UNC\\LOSSSFS0 02\\NWE_TECHNIC AL\\05. UK\\Schiehallio n (204_25a)\
\Amos&Burke_P55 9\\07. Technical (Subsurface)\\0 6. Well Planning\\Amos\
\Daily Reports\\Wireli ne\\final_204_2 5a_8z\\204_25a_ 8z\\Run_1A\
\HRLA_SP_DSI_PE X_HNGS_ECRD\\AN CILLARY\\Amos_2 04_25a-8Z_GR_to_surfac e_3-
Mar-2008_DSI_HRLA_T LD_MCFL_047PUC. las'
In addition to starting with \\?\UNC\, the path has to be an Unicode
string, and already normalized (that is, it cannot contain . nor ..
components)
--
Gabriel Genellina This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Joe Laughlin |
last post by:
I've not used C much before, so I don't know how robust or good this code
is. I'd appreciate any feedback or criticisms anyone has!
Thanks,
Joe
#include <stdio.h>
#include <string.h>
|
by: StGo |
last post by:
How can i read/write file's custom attributs(like subject,author...) in
C#???
Thanks :))
|
by: |
last post by:
Hello Guys,
I am trying to render an Xml dataset into HTML using XSLT.
When I am loading the XSLT file into transform object to
render it. Here is the code snippet:
<!--
XslTransform transCart = new XslTransform();
transCart.Load(Server.MapPath("1.xslt"));
showCart.Document = cartFromSession;
|
by: I am Sam |
last post by:
I keep getting this error and I don't know why:
The path is too long after being fully qualified. Make sure path is less
than 260 characters.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code....
|
by: Sakharam Phapale |
last post by:
Hi All,
I am using an API function, which takes file path as an input.
When file path contains special characters (@,#,$,%,&,^, etc), API function
gives an error as "Unable to open input file".
Same file path containing special characters works fine in one machine, but
doesn't work in other.
I am using following API function to get short...
| |
by: santosh |
last post by:
Hello all,
I've put together a small program to count the number of characters and
'words' in a text file. The minimum length of a word, (in terms of no.
of characters), as well as word delimiting characters can be specified
on the command line. The default delimiting characters built into the
program are space, newline, tab, carriage...
|
by: Rahul |
last post by:
Hi Everybody
I have some problem in my script. please help me. This is script file.
I have one *.inq file. I want run this script in XML files. But this
script errors shows . If u want i am attach this script
files and inq files. I cant understand this error. Please suggest me.
You can talk with my yahoo id b_sahoo1@yahoo.com. Now i am...
|
by: wb5plj |
last post by:
Hi I am having a problem passing some sql to the db2cmd via ant. This
is very confusing as I am doing this exact thing elseware with no
problem (just differant sql, and I have verified the sql is valid) but
in this one I am having problems. Any time I run this I get the
folowing message from the db2 clp window that opens up.
SQL0104N An...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |